(t *testing.T)
| 152 | } |
| 153 | |
| 154 | func TestOutboundAgentToAgent(t *testing.T) { |
| 155 | t.Skip("requires an outbound SMTP relay configured in testutil.TestServer (and a loopback to inbound for the recipient webhook to fire) — tracked as test-infra work") |
| 156 | pool := testutil.TestDB(t) |
| 157 | receiver := testutil.WebhookReceiver(t) |
| 158 | ts := testutil.TestServer(t, pool) |
| 159 | |
| 160 | _, apiKey, senderAgent := setupDomainAndAgent(t, ts, "agent@out-a.example.com", "out-a.example.com", "https://example.com/webhook", "cloud") |
| 161 | _, _, _ = setupDomainAndAgent(t, ts, "agent@out-b.example.com", "out-b.example.com", receiver.Server.URL, "cloud") |
| 162 | |
| 163 | sendPayload := `{"to":["agent@out-b.example.com"],"subject":"A2A","body":"Hello from A"}` |
| 164 | req, _ := http.NewRequest("POST", ts.HTTPServer.URL+"/v1/agents/"+url.PathEscape(senderAgent.EmailAddress())+"/messages", bytes.NewBufferString(sendPayload)) |
| 165 | req.Header.Set("Content-Type", "application/json") |
| 166 | req.Header.Set("Authorization", "Bearer "+apiKey.PlaintextKey) |
| 167 | resp, _ := http.DefaultClient.Do(req) |
| 168 | defer resp.Body.Close() |
| 169 | |
| 170 | if resp.StatusCode != 200 { |
| 171 | t.Fatalf("status = %d, want 200", resp.StatusCode) |
| 172 | } |
| 173 | |
| 174 | payloads := receiver.WaitForPayloads(t, 1, 5*time.Second) |
| 175 | p := payloads[0] |
| 176 | if p.Body.AuthHeaders["X-E2A-Auth-Entity-Type"] != "agent" { |
| 177 | t.Errorf("EntityType = %q, want agent", p.Body.AuthHeaders["X-E2A-Auth-Entity-Type"]) |
| 178 | } |
| 179 | if p.Body.AuthHeaders["X-E2A-Auth-Verified"] != "true" { |
| 180 | t.Errorf("Verified = %q, want true", p.Body.AuthHeaders["X-E2A-Auth-Verified"]) |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | func TestOutboundRequiresAuth(t *testing.T) { |
| 185 | pool := testutil.TestDB(t) |
nothing calls this directly
no test coverage detected