(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestCreateAgentDuplicate(t *testing.T) { |
| 49 | pool := testutil.TestDB(t) |
| 50 | store := identity.NewStore(pool) |
| 51 | ctx := context.Background() |
| 52 | |
| 53 | user, _ := store.CreateOrGetUser(ctx, "owner@example.com", "Owner", "google-dup-agent") |
| 54 | store.ClaimOrCreateDomain(ctx, "dup.example.com", user.ID) |
| 55 | |
| 56 | store.CreateAgent(ctx, "agent@dup.example.com", "dup.example.com", "", "https://example.com/webhook", "", user.ID) |
| 57 | _, err := store.CreateAgent(ctx, "agent@dup.example.com", "dup.example.com", "", "https://example.com/webhook2", "", user.ID) |
| 58 | if err == nil { |
| 59 | t.Error("expected error for duplicate agent") |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // TestClaimOrCreateDomain_StableOnReclaim asserts that re-claiming an |
| 64 | // unverified domain returns the row unchanged: the verification_token |
nothing calls this directly
no test coverage detected