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

Function setupAPIWithSMTP

internal/agent/api_test.go:88–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func setupAPIWithSMTP(t *testing.T) (*httptest.Server, *identity.Store, *pgxpool.Pool, func() []testutil.SMTPMessage) {
89 t.Helper()
90 smtpAddr, smtpDone := testutil.FakeSMTPServer(t)
91 pool := testutil.TestDB(t)
92 store := identity.NewStore(pool)
93 smtpRelay := outbound.NewSMTPRelay(&config.OutboundSMTPConfig{Host: smtpAddr.Host, Port: smtpAddr.Port})
94 sender := outbound.NewSender(smtpRelay, "test.e2a.dev")
95 noopUsage := usage.NewNoopUsageTracker()
96 api := agent.NewAPI(store, sender, smtpRelay, nil, noopUsage, "e2a.dev", "test.e2a.dev", "agents.e2a.dev", "", false)
97 api.SetIdempotencyStore(idempotency.NewStore(pool))
98 router := mux.NewRouter()
99 api.RegisterRoutes(router)
100 server := httptest.NewServer(router)
101 t.Cleanup(server.Close)
102 return server, store, pool, smtpDone
103}
104
105// ============================================================
106// Feedback endpoint tests

Callers

nothing calls this directly

Calls 11

SetIdempotencyStoreMethod · 0.95
RegisterRoutesMethod · 0.95
FakeSMTPServerFunction · 0.92
TestDBFunction · 0.92
NewStoreFunction · 0.92
NewSMTPRelayFunction · 0.92
NewSenderFunction · 0.92
NewNoopUsageTrackerFunction · 0.92
NewAPIFunction · 0.92
NewStoreFunction · 0.92
CleanupMethod · 0.80

Tested by

no test coverage detected