Sync shared snapshot from 51eef30
This commit is contained in:
1 parent
b3d27ff37e
commit
ec82a8a8b9
4 files changed
+93
-1
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user