(t *testing.T, agentEmail, from, subject string)
| 153 | } |
| 154 | |
| 155 | func (e *testEnv) injectInboundMessage(t *testing.T, agentEmail, from, subject string) string { |
| 156 | t.Helper() |
| 157 | ctx := context.Background() |
| 158 | ag, err := e.store.GetAgentByEmail(ctx, agentEmail) |
| 159 | if err != nil { |
| 160 | t.Fatalf("get agent: %v", err) |
| 161 | } |
| 162 | // A faithful inbound message carries its raw MIME and the X-E2A-Auth-* blob |
| 163 | // the relay stamps after SPF/DKIM/DMARC — without auth_headers the detail |
| 164 | // view omits the field (it is omitempty), which is not how a real received |
| 165 | // message looks. Populate both so the contract exercises the real shape. |
| 166 | raw := []byte("From: " + from + "\r\nTo: " + agentEmail + "\r\nSubject: " + subject + "\r\n\r\nbody\r\n") |
| 167 | authHeaders := map[string]string{ |
| 168 | "X-E2A-Auth-Results": "spf=pass; dkim=pass; dmarc=pass", |
| 169 | "X-E2A-Auth-Verified": "true", |
| 170 | } |
| 171 | msg, err := e.store.CreateInboundMessage(ctx, "", ag.ID, from, agentEmail, "", subject, "", "unread", raw, authHeaders, nil, false, "", nil, nil, nil, identity.InboundScreening{}) |
| 172 | if err != nil { |
| 173 | t.Fatalf("store message: %v", err) |
| 174 | } |
| 175 | return msg.ID |
| 176 | } |
| 177 | |
| 178 | // ── Scenario runner ──────────────────────────────────────────────── |
| 179 |
no test coverage detected