TestSMTPAPI_Cursor verifies the cursor endpoint returns a valid RFC3339 time.
(t *testing.T)
| 53 | |
| 54 | // TestSMTPAPI_Cursor verifies the cursor endpoint returns a valid RFC3339 time. |
| 55 | func TestSMTPAPI_Cursor(t *testing.T) { |
| 56 | mux, _, _ := setupAPITest(t) |
| 57 | |
| 58 | r := httptest.NewRequest("GET", "/api/smtp/cursor", nil) |
| 59 | w := httptest.NewRecorder() |
| 60 | mux.ServeHTTP(w, r) |
| 61 | |
| 62 | if w.Code != 200 { |
| 63 | t.Fatalf("status = %d", w.Code) |
| 64 | } |
| 65 | var resp map[string]string |
| 66 | json.NewDecoder(w.Body).Decode(&resp) |
| 67 | if _, err := time.Parse(time.RFC3339Nano, resp["cursor"]); err != nil { |
| 68 | t.Errorf("cursor %q is not valid RFC3339Nano: %v", resp["cursor"], err) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // TestSMTPAPI_Messages_Empty verifies an empty list when no messages exist. |
| 73 | func TestSMTPAPI_Messages_Empty(t *testing.T) { |
nothing calls this directly
no test coverage detected