MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / TestAdminLogin

Function TestAdminLogin

internal/integration_tests/admin_login_test.go:49–72  ·  view source on GitHub ↗

TestAdminLogin tests the login functionality of the Authorizer application admin.

(t *testing.T)

Source from the content-addressed store, hash-verified

47
48// TestAdminLogin tests the login functionality of the Authorizer application admin.
49func TestAdminLogin(t *testing.T) {
50 // Initialize test setup
51 cfg := getTestConfig()
52 ts := initTestSetup(t, cfg)
53 _, ctx := createContext(ts)
54
55 t.Run("should fail login with invalid admin secret", func(t *testing.T) {
56 adminLoginReq := &model.AdminLoginRequest{
57 AdminSecret: "invalid_secret",
58 }
59 adminLoginRes, err := ts.GraphQLProvider.AdminLogin(ctx, adminLoginReq)
60 require.Error(t, err)
61 assert.Nil(t, adminLoginRes)
62 })
63
64 t.Run("should complete admin login", func(t *testing.T) {
65 adminLoginReq := &model.AdminLoginRequest{
66 AdminSecret: cfg.AdminSecret,
67 }
68 res, err := ts.GraphQLProvider.AdminLogin(ctx, adminLoginReq)
69 require.NoError(t, err)
70 assert.NotNil(t, res)
71 })
72}

Callers

nothing calls this directly

Calls 6

getTestConfigFunction · 0.85
initTestSetupFunction · 0.85
createContextFunction · 0.85
ErrorMethod · 0.80
AdminLoginMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected