Skip to content

Commit ced58ca

Browse files
committed
GatewayTester: allow overriding login POST data
- Allows using the tester with non-dummy passport strategies
1 parent a692312 commit ced58ca

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

apigw/src/shared/test/gateway-tester.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,17 @@ export class GatewayTester {
8181
)
8282
}
8383

84-
public async login(user: AuthenticatedUser | EmployeeUser): Promise<void> {
84+
public async login(
85+
user: AuthenticatedUser | EmployeeUser,
86+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
87+
postData?: any
88+
): Promise<void> {
89+
postData = postData !== undefined ? postData : { preset: 'dummy' }
8590
if (this.sessionType === 'employee') {
8691
this.nockScope.post('/system/employee-identity').reply(200, user)
8792
await this.client.post(
8893
'/api/internal/auth/saml/login/callback',
89-
{ preset: 'dummy' },
94+
postData,
9095
{
9196
maxRedirects: 0,
9297
validateStatus: (status) => status >= 200 && status <= 302
@@ -97,7 +102,7 @@ export class GatewayTester {
97102
this.nockScope.post('/system/person-identity').reply(200, user)
98103
await this.client.post(
99104
'/api/application/auth/saml/login/callback',
100-
{ preset: 'dummy' },
105+
postData,
101106
{
102107
maxRedirects: 0,
103108
validateStatus: (status) => status >= 200 && status <= 302

0 commit comments

Comments
 (0)