Add additional test for method not found

This commit is contained in:
Jason McCallister 2017-10-23 22:46:32 -04:00 committed by GitHub
parent c036316c9d
commit 081fb8a5c2
1 changed files with 16 additions and 0 deletions

View File

@ -100,3 +100,19 @@ func TestHttpErrorWhenHeaderDoesNotMatch(t *testing.T) {
t.Fatal("expected Unsupported Media Type staus error")
}
}
func TestHttpErrorWhenMethodDoesNotMatch(t *testing.T) {
r, err := http.NewRequest(http.MethodPatch, "/blogs", nil)
if err != nil {
t.Fatal(err)
}
r.Header.Set(headerAccept, jsonapi.MediaType)
rr := httptest.NewRecorder()
handler := &ExampleHandler{}
handler.ServeHTTP(rr, r)
if rr.Code != http.StatusNotFound {
t.Fatal("expected HTTP Status Not Found status error")
}
}