(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func TestFakeHandlerPath(t *testing.T) { |
| 27 | handler := FakeHandler{StatusCode: http.StatusOK} |
| 28 | server := httptest.NewServer(&handler) |
| 29 | defer server.Close() |
| 30 | method := "GET" |
| 31 | path := "/foo/bar" |
| 32 | body := "somebody" |
| 33 | |
| 34 | req, err := http.NewRequest(method, server.URL+path, bytes.NewBufferString(body)) |
| 35 | if err != nil { |
| 36 | t.Errorf("unexpected error: %v", err) |
| 37 | } |
| 38 | |
| 39 | client := http.Client{} |
| 40 | _, err = client.Do(req) |
| 41 | if err != nil { |
| 42 | t.Errorf("unexpected error: %v", err) |
| 43 | } |
| 44 | |
| 45 | handler.ValidateRequest(t, path, method, &body) |
| 46 | } |
| 47 | |
| 48 | func TestFakeHandlerPathNoBody(t *testing.T) { |
| 49 | handler := FakeHandler{StatusCode: http.StatusOK} |
nothing calls this directly
no test coverage detected