Add delete endpoint

This commit is contained in:
Bel LaPointe
2020-07-23 21:20:08 -06:00
parent bdfc1c346b
commit 5af3f6f7b6
2 changed files with 40 additions and 0 deletions

View File

@@ -156,6 +156,30 @@ func TestWho(t *testing.T) {
b, _ = json.MarshalIndent(o, "", " ")
t.Logf("POST POST:\n%s", b)
})
t.Run("delete real", func(t *testing.T) {
r := httptest.NewRequest(http.MethodDelete, "/who/col?id=NEWBIE"+want.Name, nil)
w := httptest.NewRecorder()
handler.ServeHTTP(w, r)
if w.Code != http.StatusOK {
t.Fatalf("%d: %s", w.Code, w.Body.Bytes())
}
r = httptest.NewRequest(http.MethodGet, "/who/col?id=NEWBIE"+want.Name, nil)
w = httptest.NewRecorder()
handler.ServeHTTP(w, r)
if w.Code != http.StatusNotFound {
t.Fatalf("%d: %s", w.Code, w.Body.Bytes())
}
})
t.Run("delete fake", func(t *testing.T) {
r := httptest.NewRequest(http.MethodDelete, "/who/col?id=FAKER"+want.Name, nil)
w := httptest.NewRecorder()
handler.ServeHTTP(w, r)
if w.Code != http.StatusOK {
t.Fatalf("%d: %s", w.Code, w.Body.Bytes())
}
})
}
func fillDB(t *testing.T, g storage.Graph) []entity.One {