(t *testing.T)
| 83 | } |
| 84 | |
| 85 | func 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 | |
| 100 | func TestSend_SuccessFalse(t *testing.T) { |
| 101 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected