From f49a079aa103ce1b3c65ba4223526d3844a8cded Mon Sep 17 00:00:00 2001 From: Greg Russell Date: Wed, 2 Jan 2019 17:06:56 -0500 Subject: [PATCH] switch->if, TODO --- api/v2/api-v2_test.go | 10 ++++------ handler/handler_test.go | 3 +++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/v2/api-v2_test.go b/api/v2/api-v2_test.go index b7e2f4df..5ec9824d 100644 --- a/api/v2/api-v2_test.go +++ b/api/v2/api-v2_test.go @@ -25,10 +25,9 @@ func TestDoRequest(t *testing.T) { callCount := 0 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case callCount < 3: + if callCount < 3 { w.WriteHeader(http.StatusServiceUnavailable) - default: + } else { fmt.Fprint(w, expectedJson) } callCount++ @@ -67,11 +66,10 @@ func TestDoRequest(t *testing.T) { func TestSomeErrors(t *testing.T) { callCount := 0 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case callCount == 0: + if callCount == 0 { w.WriteHeader(http.StatusInternalServerError) fmt.Fprint(w, "body message") - default: + } else { w.WriteHeader(http.StatusServiceUnavailable) } callCount++ diff --git a/handler/handler_test.go b/handler/handler_test.go index 9672a05d..6f9ab1fb 100644 --- a/handler/handler_test.go +++ b/handler/handler_test.go @@ -1,5 +1,8 @@ package handler_test +// TODO 201901 - TestStatusServiceUnavailable() +// TODO 201901 - TestStatusInternalError() + import ( "bytes" "errors"