oooooo i shoulda done different but i need a router for that hmmm
This commit is contained in:
@@ -55,19 +55,6 @@ func TestRunHTTP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
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)
|
|
||||||
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/questions", func(t *testing.T) {
|
t.Run("/api/v1/questions", func(t *testing.T) {
|
||||||
r := httptest.NewRequest(http.MethodGet, "/api/v1/questions", nil)
|
r := httptest.NewRequest(http.MethodGet, "/api/v1/questions", nil)
|
||||||
r.SetBasicAuth("b", "b")
|
r.SetBasicAuth("b", "b")
|
||||||
@@ -81,8 +68,8 @@ func TestRunHTTP(t *testing.T) {
|
|||||||
t.Errorf("not impl: %s", w.Body.Bytes())
|
t.Errorf("not impl: %s", w.Body.Bytes())
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("GET /api/v1/answers", func(t *testing.T) {
|
t.Run("/api/v1/questions/0", func(t *testing.T) {
|
||||||
r := httptest.NewRequest(http.MethodGet, "/api/v1/answers", nil)
|
r := httptest.NewRequest(http.MethodGet, "/api/v1/questions/0", nil)
|
||||||
r.SetBasicAuth("b", "b")
|
r.SetBasicAuth("b", "b")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
t.Logf("%s %s", r.Method, r.URL)
|
t.Logf("%s %s", r.Method, r.URL)
|
||||||
@@ -94,8 +81,21 @@ func TestRunHTTP(t *testing.T) {
|
|||||||
t.Errorf("not impl: %s", w.Body.Bytes())
|
t.Errorf("not impl: %s", w.Body.Bytes())
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("POST /api/v1/answers", func(t *testing.T) {
|
t.Run("GET /api/v1/questions/0/answers", func(t *testing.T) {
|
||||||
r := httptest.NewRequest(http.MethodPost, "/api/v1/answers", nil)
|
r := httptest.NewRequest(http.MethodGet, "/api/v1/questions/0/answers", 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("POST /api/v1/questions/0/answers", func(t *testing.T) {
|
||||||
|
r := httptest.NewRequest(http.MethodPost, "/api/v1/questions/0/answers", nil)
|
||||||
r.SetBasicAuth("b", "b")
|
r.SetBasicAuth("b", "b")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
t.Logf("%s %s", r.Method, r.URL)
|
t.Logf("%s %s", r.Method, r.URL)
|
||||||
|
|||||||
Reference in New Issue
Block a user