mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 13:57:32 +00:00
08ae39ae19
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <livio.a@gmail.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { apiCallProperties } from "./apiauth"
|
|
import { ensureSomethingDoesntExist, ensureSomethingExists } from "./ensure"
|
|
|
|
export function ensureHumanUserExists(api: apiCallProperties, username: string): Cypress.Chainable<number> {
|
|
|
|
return ensureSomethingExists(
|
|
api,
|
|
'users/_search',
|
|
(user: any) => user.userName === username,
|
|
'users/human',
|
|
{
|
|
user_name: username,
|
|
profile: {
|
|
first_name: 'e2efirstName',
|
|
last_name: 'e2elastName',
|
|
},
|
|
email: {
|
|
email: 'e2e@email.ch',
|
|
},
|
|
phone: {
|
|
phone: '+41 123456789',
|
|
},
|
|
})
|
|
}
|
|
|
|
export function ensureMachineUserExists(api: apiCallProperties, username: string): Cypress.Chainable<number> {
|
|
|
|
return ensureSomethingExists(
|
|
api,
|
|
'users/_search',
|
|
(user: any) => user.userName === username,
|
|
'users/machine',
|
|
{
|
|
user_name: username,
|
|
name: 'e2emachinename',
|
|
description: 'e2emachinedescription',
|
|
},
|
|
)
|
|
}
|
|
|
|
export function ensureUserDoesntExist(api: apiCallProperties, username: string): Cypress.Chainable<null> {
|
|
|
|
return ensureSomethingDoesntExist(
|
|
api,
|
|
'users/_search',
|
|
(user: any) => user.userName === username,
|
|
(user) => `users/${user.id}`
|
|
)
|
|
}
|