tddddddd
This commit is contained in:
@@ -8,7 +8,9 @@ import (
|
||||
)
|
||||
|
||||
func TestRunHTTP(t *testing.T) {
|
||||
cfg := Config{}
|
||||
cfg := Config{
|
||||
fsDB: t.TempDir(),
|
||||
}
|
||||
|
||||
h := cfg.NewHandler()
|
||||
|
||||
@@ -53,8 +55,8 @@ func TestRunHTTP(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("/api/v1/question", func(t *testing.T) {
|
||||
r := httptest.NewRequest(http.MethodGet, "/api/v1/question", nil)
|
||||
t.Run("/api/v1/questions/0", func(t *testing.T) {
|
||||
r := httptest.NewRequest(http.MethodGet, "/api/v1/questions/0", nil)
|
||||
r.SetBasicAuth("b", "b")
|
||||
w := httptest.NewRecorder()
|
||||
t.Logf("%s %s", r.Method, r.URL)
|
||||
@@ -66,8 +68,21 @@ func TestRunHTTP(t *testing.T) {
|
||||
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)
|
||||
t.Run("/api/v1/questions", func(t *testing.T) {
|
||||
r := httptest.NewRequest(http.MethodGet, "/api/v1/questions", 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/answers", func(t *testing.T) {
|
||||
r := httptest.NewRequest(http.MethodGet, "/api/v1/answers", nil)
|
||||
r.SetBasicAuth("b", "b")
|
||||
w := httptest.NewRecorder()
|
||||
t.Logf("%s %s", r.Method, r.URL)
|
||||
|
||||
Reference in New Issue
Block a user