newNotifier wires a notifier talking to a fake SMTP + a fresh test DB. Returns notifier, store, signer, and the smtpDone accessor.
(t *testing.T)
| 23 | // newNotifier wires a notifier talking to a fake SMTP + a fresh test DB. |
| 24 | // Returns notifier, store, signer, and the smtpDone accessor. |
| 25 | func newNotifier(t *testing.T) ( |
| 26 | *hitlnotify.Notifier, |
| 27 | *identity.Store, |
| 28 | *approvaltoken.Signer, |
| 29 | func() []testutil.SMTPMessage, |
| 30 | ) { |
| 31 | t.Helper() |
| 32 | smtpAddr, smtpDone := testutil.FakeSMTPServer(t) |
| 33 | pool := testutil.TestDB(t) |
| 34 | store := identity.NewStore(pool) |
| 35 | relay := outbound.NewSMTPRelay(&config.OutboundSMTPConfig{ |
| 36 | Host: smtpAddr.Host, |
| 37 | Port: smtpAddr.Port, |
| 38 | FromDomain: notifyFromDomain, |
| 39 | }) |
| 40 | signer := approvaltoken.NewSigner(notifySecret) |
| 41 | n := hitlnotify.New(store, relay, signer, notifyFromDomain, publicURL) |
| 42 | return n, store, signer, smtpDone |
| 43 | } |
| 44 | |
| 45 | // setupPendingMessage creates a verified HITL-enabled agent with one |
| 46 | // pending outbound message. Returns (agent, message). |
no test coverage detected