-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add platform tests * Fix tests * Some fixes
- Loading branch information
1 parent
e998b80
commit d5d08aa
Showing
68 changed files
with
8,096 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from '../../src/tests/int/auth'; | ||
export * from '../../src/tests/int/env/platform/auth'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from '../../src/tests/int/helpers'; | ||
export * from '../../src/tests/int/env/platform/helpers'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '../../../src/tests/int/mocks/auth-zitadel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from '../../src/tests/int/roles'; | ||
export * from '../../src/tests/int/env/platform/roles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import request from 'supertest'; | ||
import type {CommonAuthArgs} from '../../auth'; | ||
import {testUserId, testUserLogin} from '../../constants'; | ||
import {AUTHORIZATION_HEADER, DL_AUTH_HEADER_KEY} from '../../../../const'; | ||
import {OpensourceRole} from './roles'; | ||
import {ZitadelUserRole} from '../../../../types/zitadel'; | ||
|
||
export {US_ERRORS, app, appConfig, testTenantId, testProjectId, authMasterToken} from '../../auth'; | ||
|
||
export type AuthArgs = CommonAuthArgs & { | ||
role?: OpensourceRole; | ||
}; | ||
|
||
export const auth = (req: request.Test, args: AuthArgs = {}) => { | ||
const {userId = testUserId, login = testUserLogin, role = OpensourceRole.Viewer} = args; | ||
|
||
let zitadelRole: ZitadelUserRole; | ||
|
||
switch (role) { | ||
case OpensourceRole.Admin: | ||
zitadelRole = ZitadelUserRole.Admin; | ||
break; | ||
case OpensourceRole.Editor: | ||
zitadelRole = ZitadelUserRole.Editor; | ||
break; | ||
default: | ||
zitadelRole = ZitadelUserRole.Viewer; | ||
break; | ||
} | ||
|
||
req.set( | ||
AUTHORIZATION_HEADER, | ||
`${DL_AUTH_HEADER_KEY} ${JSON.stringify({ | ||
userId, | ||
login, | ||
role: zitadelRole, | ||
})}`, | ||
); | ||
|
||
return req; | ||
}; |
Oops, something went wrong.