This commit is contained in:
Bel LaPointe
2024-02-20 08:13:51 -07:00
parent 9686d1c7dd
commit 4241b83721
2 changed files with 53 additions and 0 deletions

View File

@@ -40,6 +40,44 @@ func TestRunHTTP(t *testing.T) {
t.Errorf("%s", w.Body.Bytes())
}
})
t.Run("/api/notfound", func(t *testing.T) {
r := httptest.NewRequest(http.MethodGet, "/api/notfound", nil)
r.SetBasicAuth("b", "b")
w := httptest.NewRecorder()
t.Logf("%s %s", r.Method, r.URL)
h.ServeHTTP(w, r)
t.Logf("(%d) %s", w.Code, w.Body.Bytes())
if w.Code != http.StatusNotFound {
t.Error(w.Code)
}
})
t.Run("/api/v1/question", func(t *testing.T) {
r := httptest.NewRequest(http.MethodGet, "/api/v1/question", nil)
r.SetBasicAuth("b", "b")
w := httptest.NewRecorder()
t.Logf("%s %s", r.Method, r.URL)
h.ServeHTTP(w, r)
t.Logf("(%d) %s", w.Code, w.Body.Bytes())
if w.Code != http.StatusNotFound {
t.Error(w.Code)
}
t.Errorf("not impl: %s", w.Body.Bytes())
})
t.Run("/api/v1/answer", func(t *testing.T) {
r := httptest.NewRequest(http.MethodGet, "/api/v1/answer", nil)
r.SetBasicAuth("b", "b")
w := httptest.NewRecorder()
t.Logf("%s %s", r.Method, r.URL)
h.ServeHTTP(w, r)
t.Logf("(%d) %s", w.Code, w.Body.Bytes())
if w.Code != http.StatusNotFound {
t.Error(w.Code)
}
t.Errorf("not impl: %s", w.Body.Bytes())
})
}
func TestPublic(t *testing.T) {