Skip to content

Commit

Permalink
chore: correcting spelling error for middleware test function
Browse files Browse the repository at this point in the history
  • Loading branch information
waveyboym committed Jun 22, 2024
1 parent 37d33ca commit fa1075c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions occupi-backend/tests/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ func TestProtectedRouteNonMatchingSessionEmailAndToken(t *testing.T) {
token2, _, _ := authenticator.GenerateToken("[email protected]", constants.Basic)

w1 := httptest.NewRecorder()
req1, _ := http.NewRequest("GET", "/ping-auth", nil)
req1.AddCookie(&http.Cookie{Name: "token", Value: token2})

// clear previous cookie
req.Header.Del("Cookie")
req.AddCookie(&http.Cookie{Name: "token", Value: token2})

// make second request with different email and token
r.ServeHTTP(w1, req1)
r.ServeHTTP(w1, req)

assert.Equal(t, http.StatusUnauthorized, w1.Code)
assert.Equal(t, "{\"error\":{\"code\":\"INVALID_AUTH\",\"details\":null,\"message\":\"Inalid auth session\"},\"message\":\"Bad Request\",\"status\":401}", w1.Body.String())
assert.Equal(t, "{\"error\":{\"code\":\"INVALID_AUTH\",\"details\":null,\"message\":\"Invalid auth session\"},\"message\":\"Bad Request\",\"status\":401}", w1.Body.String())
}

func TestAdminRoute(t *testing.T) {
Expand Down

0 comments on commit fa1075c

Please sign in to comment.