TestAdminLogin tests the login functionality of the Authorizer application admin.
(t *testing.T)
| 47 | |
| 48 | // TestAdminLogin tests the login functionality of the Authorizer application admin. |
| 49 | func 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 | } |
nothing calls this directly
no test coverage detected