diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-10 00:47:30 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-10 00:49:34 -0400 |
commit | 824556ab9829e0ff369808621bacb5cccbee27e9 (patch) | |
tree | 13e5dcf9cbfeec4763708daac244b7e30cd3c525 /svc/http_test.go | |
parent | bedd5d588f4375b486734026c5eda861ab2bf485 (diff) | |
download | getwtxt-824556ab9829e0ff369808621bacb5cccbee27e9.tar.gz |
refactored http err handling to combine 3 funcs into 1
Diffstat (limited to 'svc/http_test.go')
-rw-r--r-- | svc/http_test.go | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/svc/http_test.go b/svc/http_test.go deleted file mode 100644 index 0faa0d3..0000000 --- a/svc/http_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package svc // import "github.com/getwtxt/getwtxt/svc" - -import ( - "errors" - "net/http" - "net/http/httptest" - "testing" -) - -func Test_log400(t *testing.T) { - initTestConf() - t.Run("log400", func(t *testing.T) { - w := httptest.NewRecorder() - req := httptest.NewRequest("POST", "/400", nil) - log400(w, req, "400 Test") - resp := w.Result() - if resp.StatusCode != http.StatusBadRequest { - t.Errorf("Didn't receive 400, received: %v\n", resp.StatusCode) - } - }) -} - -func Test_log404(t *testing.T) { - initTestConf() - t.Run("log404", func(t *testing.T) { - w := httptest.NewRecorder() - req := httptest.NewRequest("GET", "/404", nil) - log404(w, req, errors.New("404 Test")) - resp := w.Result() - if resp.StatusCode != http.StatusNotFound { - t.Errorf("Didn't receive 404, received: %v\n", resp.StatusCode) - } - }) -} - -func Test_log500(t *testing.T) { - initTestConf() - t.Run("log500", func(t *testing.T) { - w := httptest.NewRecorder() - req := httptest.NewRequest("POST", "/500", nil) - log500(w, req, errors.New("500 Test")) - resp := w.Result() - if resp.StatusCode != http.StatusInternalServerError { - t.Errorf("Didn't receive 500, received: %v\n", resp.StatusCode) - } - }) -} |