Sync shared snapshot from 51eef30

This commit is contained in:
Gabriel20xx committed 2026-09-17 00:15:32 +02:00
1 parent b3d27ff37e
commit ec82a8a8b9
4 files changed
+93 -1

No files matched your search

+17
View File
@@ -32,6 +32,10 @@ func (s *fakeProxyStore) UnclaimSetup(context.Context) error {
return nil
}
type noOpLoginProxyStore struct{ fakeProxyStore }
func (s *noOpLoginProxyStore) SetLoginRequired(context.Context, bool) error { return nil }
// TestPendingModeStillGatesRequests locks in the fix that made an empty
// authGuardURL at construction mean "pending" (auth still enabled, calls
// fail closed until a real URL arrives via SetAuthGuardBaseURL) instead of
@@ -91,6 +95,19 @@ func TestLoginDisabledUsesAdminIdentityWithoutCredentials(t *testing.T) {
}
}
func TestInternalLoginOverrideWorksWithNoOpStore(t *testing.T) {
store := &noOpLoginProxyStore{fakeProxyStore: fakeProxyStore{loginRequired: true}}
service := NewWithStore(store, "session", false, "", "testproject")
if err := service.SetLoginRequired(context.Background(), false); err != nil {
t.Fatalf("SetLoginRequired() error = %v", err)
}
user, err := service.CurrentUser(httptest.NewRequest(http.MethodGet, "/", nil))
if err != nil || user == nil || user.Username != "Admin" {
t.Fatalf("no-op store override resolved user=%+v err=%v, want Admin", user, err)
}
}
func TestNormalizeProxyCredentials(t *testing.T) {
email, username, password, err := normalizeProxyCredentials(" User@Example.com ", "user", "correct horse battery staple")
if err != nil {