(t *testing.T)
| 233 | } |
| 234 | |
| 235 | func TestOutboundResponseFormat(t *testing.T) { |
| 236 | t.Skip("requires an outbound SMTP relay configured in testutil.TestServer — tracked as test-infra work") |
| 237 | pool := testutil.TestDB(t) |
| 238 | receiver := testutil.WebhookReceiver(t) |
| 239 | ts := testutil.TestServer(t, pool) |
| 240 | |
| 241 | _, apiKey, senderAgent := setupDomainAndAgent(t, ts, "agent@resp-a.example.com", "resp-a.example.com", "https://example.com/w", "cloud") |
| 242 | _, _, _ = setupDomainAndAgent(t, ts, "agent@resp-b.example.com", "resp-b.example.com", receiver.Server.URL, "cloud") |
| 243 | |
| 244 | sendPayload := `{"to":["agent@resp-b.example.com"],"subject":"Test","body":"Hello"}` |
| 245 | req, _ := http.NewRequest("POST", ts.HTTPServer.URL+"/v1/agents/"+url.PathEscape(senderAgent.EmailAddress())+"/messages", bytes.NewBufferString(sendPayload)) |
| 246 | req.Header.Set("Content-Type", "application/json") |
| 247 | req.Header.Set("Authorization", "Bearer "+apiKey.PlaintextKey) |
| 248 | resp, _ := http.DefaultClient.Do(req) |
| 249 | defer resp.Body.Close() |
| 250 | |
| 251 | var body map[string]string |
| 252 | json.NewDecoder(resp.Body).Decode(&body) |
| 253 | |
| 254 | if body["status"] != "sent" { |
| 255 | t.Errorf("status = %q, want sent", body["status"]) |
| 256 | } |
| 257 | if body["message_id"] == "" { |
| 258 | t.Error("expected non-empty message_id") |
| 259 | } |
| 260 | if body["method"] != "smtp" { |
| 261 | t.Errorf("method = %q, want smtp", body["method"]) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func TestPollMode_E2E(t *testing.T) { |
| 266 | // The reply portion of this test sends to a non-e2a recipient |
nothing calls this directly
no test coverage detected