MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / TestSend_APIError

Function TestSend_APIError

internal/email/sender_test.go:85–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestSend_APIError(t *testing.T) {
86 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
87 w.WriteHeader(http.StatusBadRequest)
88 json.NewEncoder(w).Encode(mailerooResponse{Success: false, Message: "invalid sender"})
89 }))
90 defer ts.Close()
91
92 s := newTestSender(ts)
93
94 err := s.Send(context.Background(), "user@example.com", "", "Test", "<p>test</p>", "test")
95 if err == nil {
96 t.Fatal("expected error for 400 response")
97 }
98}
99
100func TestSend_SuccessFalse(t *testing.T) {
101 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 5

newTestSenderFunction · 0.85
WriteHeaderMethod · 0.80
SendMethod · 0.80
EncodeMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected