2021-12-30 04:31:51 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-12-31 08:58:00 +00:00
|
|
|
"github.com/authorizerdev/authorizer/server/constants"
|
2022-01-17 06:02:13 +00:00
|
|
|
"github.com/authorizerdev/authorizer/server/envstore"
|
2021-12-30 04:31:51 +00:00
|
|
|
"github.com/authorizerdev/authorizer/server/graph/model"
|
|
|
|
"github.com/authorizerdev/authorizer/server/resolvers"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2022-01-17 06:02:13 +00:00
|
|
|
func adminLoginTests(t *testing.T, s TestSetup) {
|
|
|
|
t.Helper()
|
2021-12-30 04:31:51 +00:00
|
|
|
t.Run(`should complete admin login`, func(t *testing.T) {
|
|
|
|
_, ctx := createContext(s)
|
|
|
|
_, err := resolvers.AdminLoginResolver(ctx, model.AdminLoginInput{
|
|
|
|
AdminSecret: "admin_test",
|
|
|
|
})
|
|
|
|
|
|
|
|
assert.NotNil(t, err)
|
|
|
|
|
2022-01-09 12:32:16 +00:00
|
|
|
_, err = resolvers.AdminLoginResolver(ctx, model.AdminLoginInput{
|
2022-01-20 11:22:37 +00:00
|
|
|
AdminSecret: envstore.EnvInMemoryStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret),
|
2021-12-30 04:31:51 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
assert.Nil(t, err)
|
|
|
|
})
|
|
|
|
}
|