Finish server tests

This commit is contained in:
Daniel Krol 2022-06-22 17:56:29 -04:00
parent cbcd629469
commit 94114ec36d

View file

@ -221,10 +221,21 @@ func TestServerHelperCheckAuth(t *testing.T) {
} }
func TestServerHelperGetGetDataSuccess(t *testing.T) { func TestServerHelperGetGetDataSuccess(t *testing.T) {
t.Fatalf("Test me: getGetData success") req := httptest.NewRequest(http.MethodGet, "/test", nil)
w := httptest.NewRecorder()
success := getGetData(w, req)
if !success {
t.Errorf("getGetData failed unexpectedly")
}
} }
func TestServerHelperGetGetDataErrors(t *testing.T) { func TestServerHelperGetGetDataErrors(t *testing.T) {
t.Fatalf("Test me: getGetData failure") // Only error right now is if you do a POST request
req := httptest.NewRequest(http.MethodPost, "/test", nil)
w := httptest.NewRecorder()
success := getGetData(w, req)
if success {
t.Errorf("getGetData succeeded unexpectedly")
}
} }
type TestReqStruct struct{ key string } type TestReqStruct struct{ key string }