fix: upgrade tests
This commit is contained in:
parent
7e3bd6a721
commit
c61c3024ec
|
@ -20,8 +20,10 @@ func adminLoginTests(t *testing.T, s TestSetup) {
|
|||
|
||||
assert.NotNil(t, err)
|
||||
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
_, err = resolvers.AdminLoginResolver(ctx, model.AdminLoginInput{
|
||||
AdminSecret: memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret),
|
||||
AdminSecret: adminSecret,
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -18,9 +18,12 @@ func adminLogoutTests(t *testing.T, s TestSetup) {
|
|||
_, err := resolvers.AdminLogoutResolver(ctx)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
_, err = resolvers.AdminLogoutResolver(ctx)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -18,9 +18,12 @@ func adminSessionTests(t *testing.T, s TestSetup) {
|
|||
_, err := resolvers.AdminSessionResolver(ctx)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
_, err = resolvers.AdminSessionResolver(ctx)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -20,7 +20,7 @@ func adminSignupTests(t *testing.T, s TestSetup) {
|
|||
|
||||
assert.NotNil(t, err)
|
||||
// reset env for test to pass
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyAdminSecret, "")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyAdminSecret, "")
|
||||
|
||||
_, err = resolvers.AdminSignupResolver(ctx, model.AdminSignupInput{
|
||||
AdminSecret: "admin123",
|
||||
|
|
|
@ -27,10 +27,12 @@ func deleteUserTest(t *testing.T, s TestSetup) {
|
|||
Email: email,
|
||||
})
|
||||
assert.NotNil(t, err, "unauthorized")
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
|
||||
_, err = resolvers.DeleteUserResolver(ctx, model.DeleteUserInput{
|
||||
Email: email,
|
||||
|
|
|
@ -28,10 +28,11 @@ func enableAccessTest(t *testing.T, s TestSetup) {
|
|||
})
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, verifyRes.AccessToken)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
|
||||
res, err := resolvers.RevokeAccessResolver(ctx, model.UpdateAccessInput{
|
||||
UserID: verifyRes.User.ID,
|
||||
|
|
|
@ -6,21 +6,23 @@ import (
|
|||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/env"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEnvs(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyEnvPath, "../../.env.sample")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyEnvPath, "../../.env.sample")
|
||||
env.InitAllEnv()
|
||||
store := memorystore.Provider.GetEnvStoreClone()
|
||||
store, err := memorystore.Provider.GetEnvStore()
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, store.StringEnv[constants.EnvKeyEnv], "production")
|
||||
assert.False(t, store.BoolEnv[constants.EnvKeyDisableEmailVerification])
|
||||
assert.False(t, store.BoolEnv[constants.EnvKeyDisableMagicLinkLogin])
|
||||
assert.False(t, store.BoolEnv[constants.EnvKeyDisableBasicAuthentication])
|
||||
assert.Equal(t, store.StringEnv[constants.EnvKeyJwtType], "RS256")
|
||||
assert.Equal(t, store.StringEnv[constants.EnvKeyJwtRoleClaim], "role")
|
||||
assert.EqualValues(t, store.SliceEnv[constants.EnvKeyRoles], []string{"user"})
|
||||
assert.EqualValues(t, store.SliceEnv[constants.EnvKeyDefaultRoles], []string{"user"})
|
||||
assert.EqualValues(t, store.SliceEnv[constants.EnvKeyAllowedOrigins], []string{"*"})
|
||||
assert.Equal(t, store[constants.EnvKeyEnv].(string), "production")
|
||||
assert.False(t, store[constants.EnvKeyDisableEmailVerification].(bool))
|
||||
assert.False(t, store[constants.EnvKeyDisableMagicLinkLogin].(bool))
|
||||
assert.False(t, store[constants.EnvKeyDisableBasicAuthentication].(bool))
|
||||
assert.Equal(t, store[constants.EnvKeyJwtType].(string), "RS256")
|
||||
assert.Equal(t, store[constants.EnvKeyJwtRoleClaim].(string), "role")
|
||||
assert.EqualValues(t, utils.ConvertInterfaceToStringSlice(store[constants.EnvKeyRoles]), []string{"user"})
|
||||
assert.EqualValues(t, utils.ConvertInterfaceToStringSlice(store[constants.EnvKeyDefaultRoles]), []string{"user"})
|
||||
assert.EqualValues(t, utils.ConvertInterfaceToStringSlice(store[constants.EnvKeyAllowedOrigins]), []string{"*"})
|
||||
}
|
||||
|
|
|
@ -18,12 +18,15 @@ func envTests(t *testing.T, s TestSetup) {
|
|||
_, err := resolvers.EnvResolver(ctx)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
res, err := resolvers.EnvResolver(ctx)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, *res.AdminSecret, memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
assert.Equal(t, *res.AdminSecret, adminSecret)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -30,9 +30,13 @@ func generateJWTkeyTest(t *testing.T, s TestSetup) {
|
|||
assert.Error(t, err)
|
||||
assert.Nil(t, res)
|
||||
})
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
t.Run(`should generate HS256 secret`, func(t *testing.T) {
|
||||
res, err := resolvers.GenerateJWTKeysResolver(ctx, model.GenerateJWTKeysInput{
|
||||
Type: "HS256",
|
||||
|
|
|
@ -26,9 +26,12 @@ func inviteUserTest(t *testing.T, s TestSetup) {
|
|||
assert.Error(t, err)
|
||||
assert.Nil(t, res)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
|
||||
// invalid emails test
|
||||
invalidEmailsTest := []string{
|
||||
|
|
|
@ -15,10 +15,14 @@ import (
|
|||
|
||||
func TestJwt(t *testing.T) {
|
||||
// persist older data till test is done and then reset it
|
||||
jwtType := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtType)
|
||||
publicKey := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtPublicKey)
|
||||
privateKey := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtPrivateKey)
|
||||
clientID := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyClientID)
|
||||
jwtType, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtType)
|
||||
assert.Nil(t, err)
|
||||
publicKey, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtPublicKey)
|
||||
assert.Nil(t, err)
|
||||
privateKey, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyJwtPrivateKey)
|
||||
assert.Nil(t, err)
|
||||
clientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyClientID)
|
||||
assert.Nil(t, err)
|
||||
nonce := uuid.New().String()
|
||||
hostname := "localhost"
|
||||
subject := "test"
|
||||
|
@ -33,14 +37,14 @@ func TestJwt(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Run("invalid jwt type", func(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "invalid")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "invalid")
|
||||
token, err := token.SignJWTToken(claims)
|
||||
assert.Error(t, err, "unsupported signing method")
|
||||
assert.Empty(t, token)
|
||||
})
|
||||
t.Run("expired jwt token", func(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "HS256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtSecret, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "HS256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtSecret, "test")
|
||||
expiredClaims := jwt.MapClaims{
|
||||
"exp": time.Now().Add(-time.Minute * 30).Unix(),
|
||||
"iat": time.Now().Unix(),
|
||||
|
@ -52,9 +56,9 @@ func TestJwt(t *testing.T) {
|
|||
assert.Error(t, err, err.Error(), "Token is expired")
|
||||
})
|
||||
t.Run("HMAC algorithms", func(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtSecret, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtSecret, "test")
|
||||
t.Run("HS256", func(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "HS256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "HS256")
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -63,7 +67,7 @@ func TestJwt(t *testing.T) {
|
|||
assert.Equal(t, c["email"].(string), claims["email"])
|
||||
})
|
||||
t.Run("HS384", func(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "HS384")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "HS384")
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -72,7 +76,7 @@ func TestJwt(t *testing.T) {
|
|||
assert.Equal(t, c["email"].(string), claims["email"])
|
||||
})
|
||||
t.Run("HS512", func(t *testing.T) {
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "HS512")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "HS512")
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -86,9 +90,9 @@ func TestJwt(t *testing.T) {
|
|||
t.Run("RS256", func(t *testing.T) {
|
||||
_, privateKey, publickKey, _, err := crypto.NewRSAKey("RS256", clientID)
|
||||
assert.NoError(t, err)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "RS256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publickKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "RS256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publickKey)
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -99,9 +103,9 @@ func TestJwt(t *testing.T) {
|
|||
t.Run("RS384", func(t *testing.T) {
|
||||
_, privateKey, publickKey, _, err := crypto.NewRSAKey("RS384", clientID)
|
||||
assert.NoError(t, err)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "RS384")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publickKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "RS384")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publickKey)
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -112,9 +116,9 @@ func TestJwt(t *testing.T) {
|
|||
t.Run("RS512", func(t *testing.T) {
|
||||
_, privateKey, publickKey, _, err := crypto.NewRSAKey("RS512", clientID)
|
||||
assert.NoError(t, err)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "RS512")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publickKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "RS512")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publickKey)
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -128,9 +132,9 @@ func TestJwt(t *testing.T) {
|
|||
t.Run("ES256", func(t *testing.T) {
|
||||
_, privateKey, publickKey, _, err := crypto.NewECDSAKey("ES256", clientID)
|
||||
assert.NoError(t, err)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "ES256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publickKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "ES256")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publickKey)
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -141,9 +145,9 @@ func TestJwt(t *testing.T) {
|
|||
t.Run("ES384", func(t *testing.T) {
|
||||
_, privateKey, publickKey, _, err := crypto.NewECDSAKey("ES384", clientID)
|
||||
assert.NoError(t, err)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "ES384")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publickKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "ES384")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publickKey)
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -154,9 +158,9 @@ func TestJwt(t *testing.T) {
|
|||
t.Run("ES512", func(t *testing.T) {
|
||||
_, privateKey, publickKey, _, err := crypto.NewECDSAKey("ES512", clientID)
|
||||
assert.NoError(t, err)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, "ES512")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publickKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, "ES512")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publickKey)
|
||||
jwtToken, err := token.SignJWTToken(claims)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, jwtToken)
|
||||
|
@ -166,7 +170,7 @@ func TestJwt(t *testing.T) {
|
|||
})
|
||||
})
|
||||
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtType, jwtType)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPublicKey, publicKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtType, jwtType)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPublicKey, publicKey)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyJwtPrivateKey, privateKey)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/resolvers"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -15,7 +14,6 @@ import (
|
|||
func loginTests(t *testing.T, s TestSetup) {
|
||||
t.Helper()
|
||||
t.Run(`should login`, func(t *testing.T) {
|
||||
t.Logf("=> is enabled: %v", memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableEmailVerification))
|
||||
_, ctx := createContext(s)
|
||||
email := "login." + s.TestInfo.Email
|
||||
_, err := resolvers.SignupResolver(ctx, model.SignUpInput{
|
||||
|
|
|
@ -33,7 +33,7 @@ func logoutTests(t *testing.T, s TestSetup) {
|
|||
// set all they keys in cookie one of them should be session cookie
|
||||
for key := range sessions {
|
||||
if key != token {
|
||||
cookie += fmt.Sprintf("%s=%s;", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyCookieName)+"_session", key)
|
||||
cookie += fmt.Sprintf("%s=%s;", constants.AppCookieName+"_session", key)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ func magicLinkLoginTests(t *testing.T, s TestSetup) {
|
|||
t.Run(`should login with magic link`, func(t *testing.T) {
|
||||
req, ctx := createContext(s)
|
||||
email := "magic_link_login." + s.TestInfo.Email
|
||||
memorystore.Provider.UpdateEnvVariable(constants.BoolStoreIdentifier, constants.EnvKeyDisableSignUp, true)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyDisableSignUp, true)
|
||||
_, err := resolvers.MagicLinkLoginResolver(ctx, model.MagicLinkLoginInput{
|
||||
Email: email,
|
||||
})
|
||||
assert.NotNil(t, err, "signup disabled")
|
||||
|
||||
memorystore.Provider.UpdateEnvVariable(constants.BoolStoreIdentifier, constants.EnvKeyDisableSignUp, false)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyDisableSignUp, false)
|
||||
_, err = resolvers.MagicLinkLoginResolver(ctx, model.MagicLinkLoginInput{
|
||||
Email: email,
|
||||
})
|
||||
|
|
|
@ -19,8 +19,8 @@ func TestResolvers(t *testing.T) {
|
|||
|
||||
for dbType, dbURL := range databases {
|
||||
s := testSetup()
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyDatabaseURL, dbURL)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyDatabaseType, dbType)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyDatabaseURL, dbURL)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyDatabaseType, dbType)
|
||||
defer s.Server.Close()
|
||||
err := db.InitDB()
|
||||
if err != nil {
|
||||
|
@ -35,8 +35,8 @@ func TestResolvers(t *testing.T) {
|
|||
}
|
||||
env.PersistEnv()
|
||||
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyEnv, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.BoolStoreIdentifier, constants.EnvKeyIsProd, false)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyEnv, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyIsProd, false)
|
||||
t.Run("should pass tests for "+dbType, func(t *testing.T) {
|
||||
// admin tests
|
||||
adminSignupTests(t, s)
|
||||
|
|
|
@ -34,9 +34,11 @@ func revokeAccessTest(t *testing.T, s TestSetup) {
|
|||
})
|
||||
assert.Error(t, err)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
|
||||
res, err = resolvers.RevokeAccessResolver(ctx, model.UpdateAccessInput{
|
||||
UserID: verifyRes.User.ID,
|
||||
|
|
|
@ -39,7 +39,7 @@ func sessionTests(t *testing.T, s TestSetup) {
|
|||
// set all they keys in cookie one of them should be session cookie
|
||||
for key := range sessions {
|
||||
if key != token {
|
||||
cookie += fmt.Sprintf("%s=%s;", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyCookieName)+"_session", key)
|
||||
cookie += fmt.Sprintf("%s=%s;", constants.AppCookieName+"_session", key)
|
||||
}
|
||||
}
|
||||
cookie = strings.TrimSuffix(cookie, ";")
|
||||
|
|
|
@ -30,7 +30,7 @@ func signupTests(t *testing.T, s TestSetup) {
|
|||
})
|
||||
assert.NotNil(t, err, "invalid password")
|
||||
|
||||
memorystore.Provider.UpdateEnvVariable(constants.BoolStoreIdentifier, constants.EnvKeyDisableSignUp, true)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyDisableSignUp, true)
|
||||
res, err = resolvers.SignupResolver(ctx, model.SignUpInput{
|
||||
Email: email,
|
||||
Password: s.TestInfo.Password,
|
||||
|
@ -38,7 +38,7 @@ func signupTests(t *testing.T, s TestSetup) {
|
|||
})
|
||||
assert.NotNil(t, err, "singup disabled")
|
||||
|
||||
memorystore.Provider.UpdateEnvVariable(constants.BoolStoreIdentifier, constants.EnvKeyDisableSignUp, false)
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyDisableSignUp, false)
|
||||
res, err = resolvers.SignupResolver(ctx, model.SignUpInput{
|
||||
Email: email,
|
||||
Password: s.TestInfo.Password,
|
||||
|
|
|
@ -75,14 +75,14 @@ func testSetup() TestSetup {
|
|||
Password: "Test@123",
|
||||
}
|
||||
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyEnvPath, "../../.env.sample")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyEnvPath, "../../.env.sample")
|
||||
memorystore.InitMemStore()
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeySmtpHost, "smtp.yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeySmtpPort, "2525")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeySmtpUsername, "lakhan@yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeySmtpPassword, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeySenderEmail, "info@yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.SliceStoreIdentifier, constants.EnvKeyProtectedRoles, []string{"admin"})
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySmtpHost, "smtp.yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySmtpPort, "2525")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySmtpUsername, "lakhan@yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySmtpPassword, "test")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeySenderEmail, "info@yopmail.com")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyProtectedRoles, []string{"admin"})
|
||||
memorystore.InitMemStore()
|
||||
db.InitDB()
|
||||
env.InitAllEnv()
|
||||
|
|
|
@ -16,16 +16,19 @@ func updateEnvTests(t *testing.T, s TestSetup) {
|
|||
t.Helper()
|
||||
t.Run(`should update envs`, func(t *testing.T) {
|
||||
req, ctx := createContext(s)
|
||||
originalAppURL := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
originalAppURL, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
assert.Nil(t, err)
|
||||
|
||||
data := model.UpdateEnvInput{}
|
||||
_, err := resolvers.UpdateEnvResolver(ctx, data)
|
||||
_, err = resolvers.UpdateEnvResolver(ctx, data)
|
||||
|
||||
assert.NotNil(t, err)
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
newURL := "https://test.com"
|
||||
disableLoginPage := true
|
||||
allowedOrigins := []string{"http://localhost:8080"}
|
||||
|
@ -35,11 +38,19 @@ func updateEnvTests(t *testing.T, s TestSetup) {
|
|||
AllowedOrigins: allowedOrigins,
|
||||
}
|
||||
_, err = resolvers.UpdateEnvResolver(ctx, data)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL), newURL)
|
||||
assert.True(t, memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableLoginPage))
|
||||
assert.Equal(t, memorystore.Provider.GetSliceStoreEnvVariable(constants.EnvKeyAllowedOrigins), allowedOrigins)
|
||||
|
||||
appURL, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, appURL, newURL)
|
||||
|
||||
isLoginPageDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableLoginPage)
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, isLoginPageDisabled)
|
||||
|
||||
storedOrigins, err := memorystore.Provider.GetSliceStoreEnvVariable(constants.EnvKeyAllowedOrigins)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, storedOrigins, allowedOrigins)
|
||||
|
||||
disableLoginPage = false
|
||||
data = model.UpdateEnvInput{
|
||||
|
|
|
@ -33,10 +33,11 @@ func updateUserTest(t *testing.T, s TestSetup) {
|
|||
Roles: newRoles,
|
||||
})
|
||||
assert.NotNil(t, err, "unauthorized")
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
_, err = resolvers.UpdateUserResolver(ctx, model.UpdateUserInput{
|
||||
ID: user.ID,
|
||||
Roles: newRoles,
|
||||
|
@ -44,7 +45,7 @@ func updateUserTest(t *testing.T, s TestSetup) {
|
|||
// supplier is not part of envs
|
||||
assert.Error(t, err)
|
||||
adminRole = "admin"
|
||||
memorystore.Provider.UpdateEnvVariable(constants.SliceStoreIdentifier, constants.EnvKeyProtectedRoles, []string{adminRole})
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyProtectedRoles, []string{adminRole})
|
||||
newRoles = []*string{&adminRole, &userRole}
|
||||
_, err = resolvers.UpdateUserResolver(ctx, model.UpdateUserInput{
|
||||
ID: user.ID,
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -21,7 +20,7 @@ func TestGetHostName(t *testing.T) {
|
|||
func TestGetDomainName(t *testing.T) {
|
||||
url := "http://test.herokuapp.com"
|
||||
|
||||
got := utils.GetDomainName(url)
|
||||
got := parsers.GetDomainName(url)
|
||||
want := "herokuapp.com"
|
||||
|
||||
assert.Equal(t, got, want, "domain name should be equal")
|
||||
|
|
|
@ -35,9 +35,11 @@ func usersTest(t *testing.T, s TestSetup) {
|
|||
usersRes, err := resolvers.UsersResolver(ctx, pagination)
|
||||
assert.NotNil(t, err, "unauthorized")
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
|
||||
usersRes, err = resolvers.UsersResolver(ctx, pagination)
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
@ -23,7 +22,7 @@ func TestIsValidEmail(t *testing.T) {
|
|||
func TestIsValidOrigin(t *testing.T) {
|
||||
// don't use portocal(http/https) for ALLOWED_ORIGINS while testing,
|
||||
// as we trim them off while running the main function
|
||||
memorystore.Provider.UpdateEnvVariable(constants.SliceStoreIdentifier, constants.EnvKeyAllowedOrigins, []string{"localhost:8080", "*.google.com", "*.google.in", "*abc.*"})
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyAllowedOrigins, []string{"localhost:8080", "*.google.com", "*.google.in", "*abc.*"})
|
||||
assert.False(t, validators.IsValidOrigin("http://myapp.com"), "it should be invalid origin")
|
||||
assert.False(t, validators.IsValidOrigin("http://appgoogle.com"), "it should be invalid origin")
|
||||
assert.True(t, validators.IsValidOrigin("http://app.google.com"), "it should be valid origin")
|
||||
|
@ -33,20 +32,20 @@ func TestIsValidOrigin(t *testing.T) {
|
|||
assert.True(t, validators.IsValidOrigin("http://xyx.abc.in"), "it should be valid origin")
|
||||
assert.True(t, validators.IsValidOrigin("http://xyxabc.in"), "it should be valid origin")
|
||||
assert.True(t, validators.IsValidOrigin("http://localhost:8080"), "it should be valid origin")
|
||||
memorystore.Provider.UpdateEnvVariable(constants.SliceStoreIdentifier, constants.EnvKeyAllowedOrigins, []string{"*"})
|
||||
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyAllowedOrigins, []string{"*"})
|
||||
}
|
||||
|
||||
func TestIsValidIdentifier(t *testing.T) {
|
||||
assert.False(t, utils.IsValidVerificationIdentifier("test"), "it should be invalid identifier")
|
||||
assert.True(t, utils.IsValidVerificationIdentifier(constants.VerificationTypeBasicAuthSignup), "it should be valid identifier")
|
||||
assert.True(t, utils.IsValidVerificationIdentifier(constants.VerificationTypeUpdateEmail), "it should be valid identifier")
|
||||
assert.True(t, utils.IsValidVerificationIdentifier(constants.VerificationTypeForgotPassword), "it should be valid identifier")
|
||||
assert.False(t, validators.IsValidVerificationIdentifier("test"), "it should be invalid identifier")
|
||||
assert.True(t, validators.IsValidVerificationIdentifier(constants.VerificationTypeBasicAuthSignup), "it should be valid identifier")
|
||||
assert.True(t, validators.IsValidVerificationIdentifier(constants.VerificationTypeUpdateEmail), "it should be valid identifier")
|
||||
assert.True(t, validators.IsValidVerificationIdentifier(constants.VerificationTypeForgotPassword), "it should be valid identifier")
|
||||
}
|
||||
|
||||
func TestIsValidPassword(t *testing.T) {
|
||||
assert.False(t, utils.IsValidPassword("test"), "it should be invalid password")
|
||||
assert.False(t, utils.IsValidPassword("Te@1"), "it should be invalid password")
|
||||
assert.False(t, utils.IsValidPassword("n*rp7GGTd29V{xx%{pDb@7n{](SD.!+.Mp#*$EHDGk&$pAMf7e#432Sg,Gr](j3n]jV/3F8BJJT+9u9{q=8zK:8u!rpQBaXJp%A+7r!jQj)M(vC$UX,h;;WKm$U6i#7dBnC&2ryKzKd+(y&=Ud)hErT/j;v3t..CM).8nS)9qLtV7pmP;@2QuzDyGfL7KB()k:BpjAGL@bxD%r5gcBfh7$&wutk!wzMfPFY#nkjjqyZbEHku,{jc;gvbYq2)3w=KExnYz9Vbv:;*;?f##faxkULdMpmm&yEfePixzx+[{[38zGN;3TzF;6M#Xy_tMtx:yK*n$bc(bPyGz%EYkC&]ttUF@#aZ%$QZ:u!icF@+"), "it should be invalid password")
|
||||
assert.False(t, utils.IsValidPassword("test@123"), "it should be invalid password")
|
||||
assert.True(t, utils.IsValidPassword("Test@123"), "it should be valid password")
|
||||
assert.False(t, validators.IsValidPassword("test"), "it should be invalid password")
|
||||
assert.False(t, validators.IsValidPassword("Te@1"), "it should be invalid password")
|
||||
assert.False(t, validators.IsValidPassword("n*rp7GGTd29V{xx%{pDb@7n{](SD.!+.Mp#*$EHDGk&$pAMf7e#432Sg,Gr](j3n]jV/3F8BJJT+9u9{q=8zK:8u!rpQBaXJp%A+7r!jQj)M(vC$UX,h;;WKm$U6i#7dBnC&2ryKzKd+(y&=Ud)hErT/j;v3t..CM).8nS)9qLtV7pmP;@2QuzDyGfL7KB()k:BpjAGL@bxD%r5gcBfh7$&wutk!wzMfPFY#nkjjqyZbEHku,{jc;gvbYq2)3w=KExnYz9Vbv:;*;?f##faxkULdMpmm&yEfePixzx+[{[38zGN;3TzF;6M#Xy_tMtx:yK*n$bc(bPyGz%EYkC&]ttUF@#aZ%$QZ:u!icF@+"), "it should be invalid password")
|
||||
assert.False(t, validators.IsValidPassword("test@123"), "it should be invalid password")
|
||||
assert.True(t, validators.IsValidPassword("Test@123"), "it should be valid password")
|
||||
}
|
||||
|
|
|
@ -39,10 +39,12 @@ func verificationRequestsTest(t *testing.T, s TestSetup) {
|
|||
|
||||
requests, err := resolvers.VerificationRequestsResolver(ctx, pagination)
|
||||
assert.NotNil(t, err, "unauthorized")
|
||||
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
|
||||
h, err := crypto.EncryptPassword(adminSecret)
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", constants.AdminCookieName, h))
|
||||
requests, err = resolvers.VerificationRequestsResolver(ctx, pagination)
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
|
Loading…
Reference in New Issue
Block a user