Fixes based on test case.

This commit is contained in:
mike12345567 2024-10-14 18:57:54 +01:00
parent 26ee50b10b
commit a56a228042
2 changed files with 5 additions and 1 deletions

View File

@ -516,7 +516,7 @@ export function getDBRoleID(roleName: string) {
export function getExternalRoleID(roleId: string, version?: string) { export function getExternalRoleID(roleId: string, version?: string) {
// for built-in roles we want to remove the DB role ID element (role_) // for built-in roles we want to remove the DB role ID element (role_)
if ( if (
roleId.startsWith(DocumentType.ROLE) && roleId.startsWith(`${DocumentType.ROLE}${SEPARATOR}`) &&
(isBuiltin(roleId) || version === RoleIDVersion.NAME) (isBuiltin(roleId) || version === RoleIDVersion.NAME)
) { ) {
const parts = roleId.split(SEPARATOR) const parts = roleId.split(SEPARATOR)

View File

@ -22,6 +22,10 @@ export class RoleAPI extends TestAPI {
} }
save = async (body: SaveRoleRequest, expectations?: Expectations) => { save = async (body: SaveRoleRequest, expectations?: Expectations) => {
// the tests should always be creating the "new" version of roles
if (body.version === undefined) {
body.version = "name"
}
return await this._post<SaveRoleResponse>(`/api/roles`, { return await this._post<SaveRoleResponse>(`/api/roles`, {
body, body,
expectations, expectations,