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

Function newProtectionAgent

internal/identity/protection_test.go:12–30  ·  view source on GitHub ↗
(t *testing.T, slug string)

Source from the content-addressed store, hash-verified

10)
11
12func newProtectionAgent(t *testing.T, slug string) (*identity.Store, context.Context, string, string) {
13 t.Helper()
14 pool := testutil.TestDB(t)
15 store := identity.NewStore(pool)
16 ctx := context.Background()
17 domain := slug + ".example.com"
18 user, err := store.CreateOrGetUser(ctx, "owner@"+domain, "Owner", "google-"+slug)
19 if err != nil {
20 t.Fatalf("CreateOrGetUser: %v", err)
21 }
22 if _, err := store.ClaimOrCreateDomain(ctx, domain, user.ID); err != nil {
23 t.Fatalf("ClaimOrCreateDomain: %v", err)
24 }
25 agent, err := store.CreateAgent(ctx, "agent@"+domain, domain, "", "", "", user.ID)
26 if err != nil {
27 t.Fatalf("CreateAgent: %v", err)
28 }
29 return store, ctx, agent.ID, user.ID
30}
31
32// TestUpdateAgentProtectionRoundTrip: a fresh agent defaults to sensitivity 'off';
33// UpdateAgentProtection persists the gate, the sensitivity columns, AND the

Calls 5

CreateOrGetUserMethod · 0.95
ClaimOrCreateDomainMethod · 0.95
CreateAgentMethod · 0.95
TestDBFunction · 0.92
NewStoreFunction · 0.92

Tested by

no test coverage detected