@@ -380,9 +380,6 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
380380 // By default, all omitted routes check for just "authorize" called
381381 routeAssertions = routeCheck {}
382382 }
383- if routeAssertions .StatusCode == 0 {
384- routeAssertions .StatusCode = http .StatusForbidden
385- }
386383
387384 // Replace all url params with known values
388385 route = strings .ReplaceAll (route , "{organization}" , admin .OrganizationID .String ())
@@ -413,7 +410,14 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
413410
414411 if ! routeAssertions .NoAuthorize {
415412 assert .NotNil (t , authorizer .Called , "authorizer expected" )
416- assert .Equal (t , routeAssertions .StatusCode , resp .StatusCode , "expect unauthorized" )
413+ if routeAssertions .StatusCode != 0 {
414+ assert .Equal (t , routeAssertions .StatusCode , resp .StatusCode , "expect unauthorized" )
415+ } else {
416+ // It's either a 404 or 403.
417+ if resp .StatusCode != http .StatusNotFound {
418+ assert .Equal (t , http .StatusForbidden , resp .StatusCode , "expect unauthorized" )
419+ }
420+ }
417421 if authorizer .Called != nil {
418422 if routeAssertions .AssertAction != "" {
419423 assert .Equal (t , routeAssertions .AssertAction , authorizer .Called .Action , "resource action" )
0 commit comments