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