feat: add api for admin login
This commit is contained in:
27
server/__test__/admin_login_test.go
Normal file
27
server/__test__/admin_login_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/resolvers"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func aminLoginTests(s TestSetup, t *testing.T) {
|
||||
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)
|
||||
|
||||
res, err := resolvers.AdminLoginResolver(ctx, model.AdminLoginInput{
|
||||
AdminSecret: "admin",
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Greater(t, len(res.AccessToken), 0)
|
||||
})
|
||||
}
|
@@ -10,9 +10,9 @@ import (
|
||||
|
||||
func TestResolvers(t *testing.T) {
|
||||
databases := map[string]string{
|
||||
enum.Sqlite.String(): "../../data.db",
|
||||
enum.Arangodb.String(): "http://root:root@localhost:8529",
|
||||
enum.Mongodb.String(): "mongodb://localhost:27017",
|
||||
enum.Sqlite.String(): "../../data.db",
|
||||
// enum.Arangodb.String(): "http://root:root@localhost:8529",
|
||||
// enum.Mongodb.String(): "mongodb://localhost:27017",
|
||||
}
|
||||
|
||||
for dbType, dbURL := range databases {
|
||||
@@ -42,6 +42,7 @@ func TestResolvers(t *testing.T) {
|
||||
usersTest(s, t)
|
||||
deleteUserTest(s, t)
|
||||
updateUserTest(s, t)
|
||||
aminLoginTests(s, t)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user