feat: complete remaining Go backend modules
This commit is contained in:
@@ -63,6 +63,22 @@ func TestPlatformAuthorizerUsesSharedChunkReader(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlatformAuthorizerCanDisableAnonymousAdministratorFallback(t *testing.T) {
|
||||
authorizer, err := NewPlatformAuthorizer(
|
||||
AuthState{Required: false, Configured: false},
|
||||
nil,
|
||||
WithLocalDevelopmentFallback(false),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = authorizer.Authorize(httptest.NewRequest(http.MethodGet, "/protected", nil), PlatformSuperAdmin)
|
||||
var authErr *PlatformAuthError
|
||||
if !errors.As(err, &authErr) || authErr.Status != http.StatusUnauthorized || authErr.Kind != PlatformUnauthenticated {
|
||||
t.Fatalf("error=%#v, want unauthenticated/401", err)
|
||||
}
|
||||
}
|
||||
|
||||
type platformSessionResolverStub struct {
|
||||
outcome string
|
||||
session identity.Session
|
||||
|
||||
Reference in New Issue
Block a user