Feat/dashboard (#105)

This commit is contained in:
Lakhan Samani
2022-01-17 11:32:13 +05:30
committed by GitHub
parent 7ce96367a3
commit f1b4141367
120 changed files with 3381 additions and 3044 deletions

29
server/test/env_test.go Normal file
View File

@@ -0,0 +1,29 @@
package test
import (
"testing"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/env"
"github.com/authorizerdev/authorizer/server/envstore"
"github.com/stretchr/testify/assert"
)
func TestEnvs(t *testing.T) {
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.EnvKeyEnvPath, "../../.env.sample")
env.InitEnv()
store := envstore.EnvInMemoryStoreObj.GetEnvStoreClone()
assert.Equal(t, store[constants.EnvKeyAdminSecret].(string), "admin")
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), "HS256")
assert.Equal(t, store[constants.EnvKeyJwtSecret].(string), "random_string")
assert.Equal(t, store[constants.EnvKeyJwtRoleClaim].(string), "role")
assert.EqualValues(t, store[constants.EnvKeyRoles].([]string), []string{"user"})
assert.EqualValues(t, store[constants.EnvKeyDefaultRoles].([]string), []string{"user"})
assert.EqualValues(t, store[constants.EnvKeyProtectedRoles].([]string), []string{"admin"})
assert.EqualValues(t, store[constants.EnvKeyAllowedOrigins].([]string), []string{"*"})
}