feat: add admin logout

This commit is contained in:
Lakhan Samani
2021-12-31 23:06:06 +05:30
parent 192070c18e
commit 152ab6dfd5
7 changed files with 111 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
package test
import (
"testing"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/resolvers"
"github.com/authorizerdev/authorizer/server/utils"
"github.com/stretchr/testify/assert"
)
func adminLogoutTests(s TestSetup, t *testing.T) {
t.Run(`should get admin session`, func(t *testing.T) {
req, ctx := createContext(s)
_, err := resolvers.AdminLogout(ctx)
assert.NotNil(t, err)
h, err := utils.HashPassword(constants.EnvData.ADMIN_SECRET)
assert.Nil(t, err)
req.Header.Add("Authorization", "Bearer "+h)
_, err = resolvers.AdminLogout(ctx)
assert.Nil(t, err)
})
}

View File

@@ -45,6 +45,7 @@ func TestResolvers(t *testing.T) {
deleteUserTest(s, t)
updateUserTest(s, t)
adminLoginTests(s, t)
adminLogoutTests(s, t)
adminSessionTests(s, t)
updateConfigTests(s, t)
configTests(s, t)