fix: memory store upgrade in resolvers
This commit is contained in:
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/crypto"
|
||||
"github.com/authorizerdev/authorizer/server/envstore"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/resolvers"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -16,16 +16,16 @@ func updateEnvTests(t *testing.T, s TestSetup) {
|
||||
t.Helper()
|
||||
t.Run(`should update envs`, func(t *testing.T) {
|
||||
req, ctx := createContext(s)
|
||||
originalAppURL := envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
originalAppURL := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAppURL)
|
||||
|
||||
data := model.UpdateEnvInput{}
|
||||
_, err := resolvers.UpdateEnvResolver(ctx, data)
|
||||
|
||||
assert.NotNil(t, err)
|
||||
|
||||
h, err := crypto.EncryptPassword(envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
h, err := crypto.EncryptPassword(memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
|
||||
assert.Nil(t, err)
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
req.Header.Set("Cookie", fmt.Sprintf("%s=%s", memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminCookieName), h))
|
||||
newURL := "https://test.com"
|
||||
disableLoginPage := true
|
||||
allowedOrigins := []string{"http://localhost:8080"}
|
||||
@@ -37,9 +37,9 @@ func updateEnvTests(t *testing.T, s TestSetup) {
|
||||
_, err = resolvers.UpdateEnvResolver(ctx, data)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAppURL), newURL)
|
||||
assert.True(t, envstore.EnvStoreObj.GetBoolStoreEnvVariable(constants.EnvKeyDisableLoginPage))
|
||||
assert.Equal(t, envstore.EnvStoreObj.GetSliceStoreEnvVariable(constants.EnvKeyAllowedOrigins), allowedOrigins)
|
||||
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)
|
||||
|
||||
disableLoginPage = false
|
||||
data = model.UpdateEnvInput{
|
||||
|
Reference in New Issue
Block a user