mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 22:07:32 +00:00
51febd7e4e
* add specs that cover the b2b demo * update cypress * test handling manager roles * use shared mocha contexts * use beforeEach instead of before * improve readability * improve application test * remove static waits * remove old awaitDesired * test owned project authorizations * simplify ensure.ts * test granted projects authz * disable prevSubject for shouldNotExist * await non-existence, then expect no error * update dependencies * fix tests from scratch * fix settings tests from scratch * Apply suggestions from code review Co-authored-by: Max Peintner <max@caos.ch> * Implement code review suggestions * use spread operator * settings properties must match * add check settings object * revert spread operator Co-authored-by: Max Peintner <max@caos.ch>
23 lines
671 B
TypeScript
23 lines
671 B
TypeScript
import { ensureItemExists } from './ensure';
|
|
import { getOrgUnderTest } from './orgs';
|
|
import { API } from './types';
|
|
|
|
export function ensureProjectGrantExists(
|
|
api: API,
|
|
foreignOrgId: number,
|
|
foreignProjectId: number,
|
|
): Cypress.Chainable<number> {
|
|
return getOrgUnderTest(api).then((orgUnderTest) => {
|
|
return ensureItemExists(
|
|
api,
|
|
`${api.mgmtBaseURL}/projectgrants/_search`,
|
|
(grant: any) => grant.grantedOrgId == orgUnderTest && grant.projectId == foreignProjectId,
|
|
`${api.mgmtBaseURL}/projects/${foreignProjectId}/grants`,
|
|
{ granted_org_id: orgUnderTest },
|
|
foreignOrgId,
|
|
'grantId',
|
|
'grantId',
|
|
);
|
|
});
|
|
}
|