You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It writes a status teapot before the auth event, and then checks to see if that status changes:
if resp.Code != http.StatusTeapot {
t.Error("should have left the response alone once teapot was sent")
}
Why would the status not change? Why is this being tested? I can see that this verifies that the correct events were being called, but what is the purpose of writing the status code? Isn't the event already being verified in the "normal" test?:
t.Run("normal", func(t *testing.T) {
t.Parallel()
h := setupMore(testSetup()) var beforeCalled, afterCalled bool
var beforeHasValues, afterHasValues bool
h.ab.Events.Before(authboss.EventAuth, func(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
beforeCalled = true
beforeHasValues = r.Context().Value(authboss.CTXKeyValues) != nil
return false, nil
})
The text was updated successfully, but these errors were encountered:
It's probably testing the code to prevent panics since http.ResponseWriter's normal Go HTTP Server implementation panics if you set the status twice. It wants to ensure the status isn't changing.
What is the purpose of these test methods in auth.go?
It writes a status teapot before the auth event, and then checks to see if that status changes:
Why would the status not change? Why is this being tested? I can see that this verifies that the correct events were being called, but what is the purpose of writing the status code? Isn't the event already being verified in the "normal" test?:
The text was updated successfully, but these errors were encountered: