feat: complete remaining Go backend modules

This commit is contained in:
2026-08-14 00:02:43 +08:00
parent cea2751dc5
commit aef5a97165
145 changed files with 18376 additions and 199 deletions

View File

@@ -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