Finish server tests
This commit is contained in:
parent
cbcd629469
commit
94114ec36d
1 changed files with 13 additions and 2 deletions
|
@ -221,10 +221,21 @@ func TestServerHelperCheckAuth(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) {
|
||||
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 }
|
||||
|
|
Loading…
Reference in a new issue