Record generated users passwords in test context

This commit is contained in:
Pedro Silva 2022-12-02 19:04:23 +00:00
parent c0c8262561
commit 0034bbbe2d
1 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import InternalAPIClient from "../../../config/internal-api/TestConfiguration/In
import generateApp from "../../../config/internal-api/fixtures/applications" import generateApp from "../../../config/internal-api/fixtures/applications"
import generator from "../../../config/generator" import generator from "../../../config/generator"
import { generateAdmin, generateAppUser, generateDeveloper, generateInviteUser } from "../../../config/internal-api/fixtures/userManagement" import { generateAdmin, generateAppUser, generateDeveloper, generateInviteUser } from "../../../config/internal-api/fixtures/userManagement"
import generate from "../../../config/internal-api/fixtures/applications"
describe("Internal API - User Management & Permissions", () => { describe("Internal API - User Management & Permissions", () => {
const api = new InternalAPIClient() const api = new InternalAPIClient()
@ -22,9 +23,14 @@ describe("Internal API - User Management & Permissions", () => {
await config.userManagement.searchUsers() await config.userManagement.searchUsers()
await config.userManagement.getRoles() await config.userManagement.getRoles()
const [adminResponse, adminData] = await config.userManagement.addUsers(generateAdmin()) // These need to be saved to the context so the passwords can be used to login
const [devResponse, devData] = await config.userManagement.addUsers(generateDeveloper()) const admin = generateAdmin()
const [userResponse, userData] = await config.userManagement.addUsers(generateAppUser()) const developer = generateDeveloper()
const appUser = generateAppUser()
const [adminResponse, adminData] = await config.userManagement.addUsers(admin)
const [devResponse, devData] = await config.userManagement.addUsers(developer)
const [userResponse, userData] = await config.userManagement.addUsers(appUser)
const [allUsersResponse, allUsersData] = await config.userManagement.getAllUsers() const [allUsersResponse, allUsersData] = await config.userManagement.getAllUsers()
expect(allUsersData.length).toBeGreaterThan(0) expect(allUsersData.length).toBeGreaterThan(0)