From b737b440b1274ac05e593f58b2d3ea92d325037c Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:36:44 -0700 Subject: [PATCH] oooooo i shoulda done different but i need a router for that hmmm --- cmd/server/main_test.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/server/main_test.go b/cmd/server/main_test.go index 43cf210..178bf30 100644 --- a/cmd/server/main_test.go +++ b/cmd/server/main_test.go @@ -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) { r := httptest.NewRequest(http.MethodGet, "/api/v1/questions", nil) r.SetBasicAuth("b", "b") @@ -81,8 +68,8 @@ func TestRunHTTP(t *testing.T) { t.Errorf("not impl: %s", w.Body.Bytes()) }) - t.Run("GET /api/v1/answers", func(t *testing.T) { - r := httptest.NewRequest(http.MethodGet, "/api/v1/answers", 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) @@ -94,8 +81,21 @@ func TestRunHTTP(t *testing.T) { t.Errorf("not impl: %s", w.Body.Bytes()) }) - t.Run("POST /api/v1/answers", func(t *testing.T) { - r := httptest.NewRequest(http.MethodPost, "/api/v1/answers", nil) + t.Run("GET /api/v1/questions/0/answers", func(t *testing.T) { + 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") w := httptest.NewRecorder() t.Logf("%s %s", r.Method, r.URL)