-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server tests #337
Server tests #337
Conversation
Dev to yolo: time tests
Yolo to stage: time tests
Stage to master: time tests
tests/server-tests/api_test.go
Outdated
@@ -15,7 +15,7 @@ func newrequest(file string, method string, body io.Reader) (*http.Request, erro | |||
req, err := http.NewRequest(method, file, body) | |||
if err != nil { | |||
// handle err | |||
fmt.Errorf("Error on NewRequest; exiting...") | |||
err = fmt.Errorf("Error on NewRequest; exiting...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand. Aren't we wiping out the err we want to pass back?
tests/server-tests/api_test.go
Outdated
@@ -47,17 +48,17 @@ func testMKCOL(t *testing.T, client *http.Client, dirname string) (string, error | |||
req, err := newrequest(dirname, "MKCOL", nil) | |||
if err != nil { | |||
// handle error | |||
t.Errorf("testMKCOL: Error: %v", t) | |||
t.Errorf("testMKCOL: Error: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
't' instead of 'err' was probably just a brain fart on my part, but what would 't' print here? Anything extra of value?
tests/server-tests/api_test.go
Outdated
if err != nil { | ||
// handle err | ||
fmt.Printf("Error on client.Do; err: %v, exiting ...\n", err) | ||
t.Errorf("Error on client.Do; exiting...\n") | ||
return "", err | ||
} | ||
defer resp.Body.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done. I blindly followed a policy: put the defer next to the call.
Still pretty much a WIP. Just basic API tests against a server.