Skip to content
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

Merged
merged 7 commits into from
Apr 12, 2017
Merged

Server tests #337

merged 7 commits into from
Apr 12, 2017

Conversation

jerryblakley
Copy link
Contributor

Still pretty much a WIP. Just basic API tests against a server.

@@ -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...")
Copy link
Contributor Author

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?

@@ -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)
Copy link
Contributor Author

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?

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()
Copy link
Contributor Author

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.

@jerryblakley jerryblakley merged commit 48a0689 into dev Apr 12, 2017
@jerryblakley jerryblakley deleted the server-tests branch April 12, 2017 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant