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

Function selfAgent

internal/agent/selfsend_test.go:70–92  ·  view source on GitHub ↗

selfAgent provisions a verified domain + agent owned by a fresh user and returns the user and the loaded agent identity ready for DeliverOutbound.

(t *testing.T, store *identity.Store, label string)

Source from the content-addressed store, hash-verified

68// selfAgent provisions a verified domain + agent owned by a fresh user and
69// returns the user and the loaded agent identity ready for DeliverOutbound.
70func selfAgent(t *testing.T, store *identity.Store, label string) (*identity.User, *identity.AgentIdentity) {
71 t.Helper()
72 ctx := context.Background()
73 user, err := store.CreateOrGetUser(ctx, "self-"+label+"@example.com", "Owner", "google-self-"+label)
74 if err != nil {
75 t.Fatalf("CreateOrGetUser: %v", err)
76 }
77 domain := "self" + label + ".example.com"
78 if _, err := store.ClaimOrCreateDomain(ctx, domain, user.ID); err != nil {
79 t.Fatalf("ClaimOrCreateDomain: %v", err)
80 }
81 if err := store.VerifyDomain(ctx, domain, user.ID); err != nil {
82 t.Fatalf("VerifyDomain: %v", err)
83 }
84 if _, err := store.CreateAgent(ctx, "bot@"+domain, domain, "", "", "local", user.ID); err != nil {
85 t.Fatalf("CreateAgent: %v", err)
86 }
87 ag, err := store.GetAgentByEmail(ctx, "bot@"+domain)
88 if err != nil {
89 t.Fatalf("GetAgentByEmail: %v", err)
90 }
91 return user, ag
92}
93
94// TestSelfSend_HappyPath: an agent sending to its own address short-circuits
95// to the loopback path (no SMTP) and lands BOTH an outbound and an inbound row

Calls 5

CreateOrGetUserMethod · 0.80
ClaimOrCreateDomainMethod · 0.80
VerifyDomainMethod · 0.80
CreateAgentMethod · 0.80
GetAgentByEmailMethod · 0.65

Tested by

no test coverage detected