MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestDeleteAPIKey

Function TestDeleteAPIKey

internal/identity/store_test.go:221–238  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

219}
220
221func TestDeleteAPIKey(t *testing.T) {
222 pool := testutil.TestDB(t)
223 store := identity.NewStore(pool)
224 ctx := context.Background()
225
226 user, _ := store.CreateOrGetUser(ctx, "apikey-del@example.com", "Owner", "google-apikey-del")
227 key, _ := store.CreateAPIKey(ctx, user.ID, "to-delete", nil)
228
229 err := store.DeleteAPIKey(ctx, key.ID, user.ID)
230 if err != nil {
231 t.Fatalf("DeleteAPIKey: %v", err)
232 }
233
234 keys, _ := store.ListAPIKeys(ctx, user.ID)
235 if len(keys) != 0 {
236 t.Errorf("expected 0 keys after delete, got %d", len(keys))
237 }
238}
239
240func TestGetUserByAPIKey(t *testing.T) {
241 pool := testutil.TestDB(t)

Callers

nothing calls this directly

Calls 6

CreateOrGetUserMethod · 0.95
CreateAPIKeyMethod · 0.95
DeleteAPIKeyMethod · 0.95
ListAPIKeysMethod · 0.95
TestDBFunction · 0.92
NewStoreFunction · 0.92

Tested by

no test coverage detected