Skip to content

Commit

Permalink
chore(lint): disable staticcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Bo-Yi Wu <[email protected]>
  • Loading branch information
appleboy committed Dec 11, 2021
1 parent e046645 commit 3b75e93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions auth_jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ func TestLoginHandler(t *testing.T) {

assert.Equal(t, ErrMissingLoginValues.Error(), message.String())
assert.Equal(t, http.StatusUnauthorized, r.Code)
//nolint:staticcheck
assert.Equal(t, "application/json; charset=utf-8", r.HeaderMap.Get("Content-Type"))
})

Expand All @@ -311,7 +312,9 @@ func TestLoginHandler(t *testing.T) {
message := gjson.Get(r.Body.String(), "message")
assert.Equal(t, "login successfully", message.String())
assert.Equal(t, http.StatusOK, r.Code)
//nolint:staticcheck
assert.True(t, strings.HasPrefix(r.HeaderMap.Get("Set-Cookie"), "jwt="))
//nolint:staticcheck
assert.True(t, strings.HasSuffix(r.HeaderMap.Get("Set-Cookie"), "; Path=/; Domain=example.com; Max-Age=3600"))
})
}
Expand Down Expand Up @@ -1108,6 +1111,7 @@ func TestSendAuthorizationBool(t *testing.T) {
"Authorization": "Bearer " + makeTokenString("HS256", "admin"),
}).
Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
//nolint:staticcheck
token := r.HeaderMap.Get("Authorization")
assert.Equal(t, "Bearer "+makeTokenString("HS256", "admin"), token)
assert.Equal(t, http.StatusOK, r.Code)
Expand Down Expand Up @@ -1288,6 +1292,7 @@ func TestLogout(t *testing.T) {
r.POST("/logout").
Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) {
assert.Equal(t, http.StatusOK, r.Code)
//nolint:staticcheck
assert.Equal(t, fmt.Sprintf("%s=; Path=/; Domain=%s; Max-Age=0", cookieName, cookieDomain), r.HeaderMap.Get("Set-Cookie"))
})
}

0 comments on commit 3b75e93

Please sign in to comment.