summary refs log blame commit diff stats
path: root/src/gifs/crystal-tilde.gif
blob: 6241e1ab1a975fde4a8c1438fe97e2acc5132483 (plain) (tree)
blob is binary.
id='n2' href='#n2'>2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
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)
		}
	})
}