MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestDisableUserNotFound

Function TestDisableUserNotFound

controlplane/admin/kill_switch_test.go:158–170  ·  view source on GitHub ↗

TestDisableUserNotFound: an unknown user yields 404 and does not fan out.

(t *testing.T)

Source from the content-addressed store, hash-verified

156
157// TestDisableUserNotFound: an unknown user yields 404 and does not fan out.
158func TestDisableUserNotFound(t *testing.T) {
159 fetcher := &fakePeerFetcher{}
160 users := &fakeUserAdmin{notFound: true}
161 r := killSwitchRouter(&fakeLiveInfo{}, fetcher, users)
162
163 code, _ := doPost(t, r, "/api/v1/orgs/acme/users/ghost/disable")
164 if code != http.StatusNotFound {
165 t.Fatalf("expected 404 for unknown user, got %d", code)
166 }
167 if fetcher.postCallCount() != 0 {
168 t.Fatalf("a 404 disable must not fan out")
169 }
170}
171
172// TestDisableEnableUnavailableWithoutUserAdmin: without a UserAdmin wired (nil),
173// disable/enable degrade to 503 rather than panicking.

Callers

nothing calls this directly

Calls 3

postCallCountMethod · 0.95
killSwitchRouterFunction · 0.85
doPostFunction · 0.85

Tested by

no test coverage detected