mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
0530f19d94
* feat: allow usernames without @ when UserMustBeDomain false * e2e * test(e2e): table driven tests for humans and machines * cleanup * fix(e2e): ensure there are no username conflicts * e2e: make awaitDesired async * rm settings mapping * e2e: make awaitDesired async * e2e: parse sequence as int * e2e: ensure test fails if awaitDesired fails Co-authored-by: Max Peintner <max@caos.ch>
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { requestHeaders } from './apiauth';
|
|
import { API } from './types';
|
|
import { ensureSetting } from './ensure';
|
|
|
|
export enum Policy {
|
|
Label = 'label',
|
|
}
|
|
|
|
export function resetPolicy(api: API, policy: Policy) {
|
|
cy.request({
|
|
method: 'DELETE',
|
|
url: `${api.mgmtBaseURL}/policies/${policy}`,
|
|
headers: requestHeaders(api),
|
|
}).then((res) => {
|
|
expect(res.status).to.equal(200);
|
|
return null;
|
|
});
|
|
}
|
|
|
|
export function ensureDomainPolicy(
|
|
api: API,
|
|
userLoginMustBeDomain: boolean,
|
|
validateOrgDomains: boolean,
|
|
smtpSenderAddressMatchesInstanceDomain: boolean,
|
|
): Cypress.Chainable<number> {
|
|
return ensureSetting(
|
|
api,
|
|
`${api.adminBaseURL}/policies/domain`,
|
|
(body: any) => {
|
|
const result = {
|
|
sequence: parseInt(<string>body.policy?.details?.sequence),
|
|
id: body.policy?.details?.resourceOwner,
|
|
entity: null,
|
|
};
|
|
if (
|
|
body.policy &&
|
|
(body.policy.userLoginMustBeDomain ? body.policy.userLoginMustBeDomain : false) == userLoginMustBeDomain &&
|
|
(body.policy.validateOrgDomains ? body.policy.validateOrgDomains : false) == validateOrgDomains &&
|
|
(body.policy.smtpSenderAddressMatchesInstanceDomain ? body.policy.smtpSenderAddressMatchesInstanceDomain : false) ==
|
|
smtpSenderAddressMatchesInstanceDomain
|
|
) {
|
|
return { ...result, entity: body.policy };
|
|
}
|
|
return result;
|
|
},
|
|
`${api.adminBaseURL}/policies/domain`,
|
|
{
|
|
userLoginMustBeDomain: userLoginMustBeDomain,
|
|
validateOrgDomains: validateOrgDomains,
|
|
smtpSenderAddressMatchesInstanceDomain: smtpSenderAddressMatchesInstanceDomain,
|
|
},
|
|
);
|
|
}
|