Skip to content

Commit

Permalink
minor test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
flimzy committed Jun 6, 2021
1 parent 5bf46dd commit bb0ef81
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions chttp/cookieauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,19 +335,12 @@ func Test401Response(t *testing.T) {
_, err = c.DoError(context.Background(), "GET", "/foo", nil)

// this causes a skip so this won't work for us.
//testy.StatusError(t, "Unauthorized: You are not authorized to access this db.", 401, err)
if err == nil {
t.Fatal("Should have an auth error")
// testy.StatusError(t, "Unauthorized: You are not authorized to access this db.", 401, err)
if !testy.ErrorMatches("Unauthorized: You are not authorized to access this db.", err) {
t.Fatalf("Unexpected error: %s", err)
}
if err != nil {
errString := err.Error()
if errString != "Unauthorized: You are not authorized to access this db." {
t.Errorf("Unexpected error: %s", err)
}
actualStatus := testy.StatusCode(err)
if 401 != actualStatus {
t.Errorf("Unexpected status code: %d (expected %d)", actualStatus, 401)
}
if status := testy.StatusCode(err); status != http.StatusUnauthorized {
t.Errorf("Unexpected status code: %d", status)
}

var noCookie *http.Cookie
Expand Down

0 comments on commit bb0ef81

Please sign in to comment.