Properly reset global state in auth tests

This commit is contained in:
sirkrypt0
2021-05-05 11:33:44 +02:00
parent 9efd08a4c0
commit e230ea854c
2 changed files with 24 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ func mockHTTPHandler(writer http.ResponseWriter, _ *http.Request) {
}
func TestNewRouterV1WithAuthenticationDisabled(t *testing.T) {
config.Config.Server.Token = ""
router := mux.NewRouter()
v1 := newRouterV1(router)
@@ -64,4 +65,5 @@ func TestNewRouterV1WithAuthenticationEnabled(t *testing.T) {
router.ServeHTTP(recorder, request)
assert.Equal(t, http.StatusUnauthorized, recorder.Code)
})
config.Config.Server.Token = ""
}