2022-01-09 17:35:37 +05:30
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/authorizerdev/authorizer/server/constants"
|
|
|
|
"github.com/authorizerdev/authorizer/server/graph/model"
|
2022-05-30 09:19:55 +05:30
|
|
|
"github.com/authorizerdev/authorizer/server/memorystore"
|
2022-01-09 17:35:37 +05:30
|
|
|
"github.com/authorizerdev/authorizer/server/resolvers"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2022-01-17 11:32:13 +05:30
|
|
|
func adminSignupTests(t *testing.T, s TestSetup) {
|
|
|
|
t.Helper()
|
2022-01-31 11:35:24 +05:30
|
|
|
t.Run(`should complete admin signup`, func(t *testing.T) {
|
2022-01-09 17:35:37 +05:30
|
|
|
_, ctx := createContext(s)
|
2022-01-09 18:40:30 +05:30
|
|
|
_, err := resolvers.AdminSignupResolver(ctx, model.AdminSignupInput{
|
2022-01-09 17:35:37 +05:30
|
|
|
AdminSecret: "admin",
|
|
|
|
})
|
2022-01-17 11:32:13 +05:30
|
|
|
|
2022-01-09 17:35:37 +05:30
|
|
|
assert.NotNil(t, err)
|
|
|
|
// reset env for test to pass
|
2022-05-30 12:47:50 +05:30
|
|
|
memorystore.Provider.UpdateEnvVariable(constants.EnvKeyAdminSecret, "")
|
2022-01-09 17:35:37 +05:30
|
|
|
|
2022-01-09 18:40:30 +05:30
|
|
|
_, err = resolvers.AdminSignupResolver(ctx, model.AdminSignupInput{
|
2022-01-31 11:35:24 +05:30
|
|
|
AdminSecret: "admin123",
|
2022-01-09 17:35:37 +05:30
|
|
|
})
|
2023-03-29 07:06:33 +05:30
|
|
|
assert.NoError(t, err)
|
2022-01-09 17:35:37 +05:30
|
|
|
})
|
|
|
|
}
|