mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
ui: VAULT-6511 PKI Overview Page (#18599)
* Inital pki overview page code setup * Add more properties to pki-overview * Remove previous selectable card component and update template * Add capability check for roles and issuers * Add acceptance tests for overview page * Update SelectableCardForm component * Code refactor! * Add selectable-card-form test * More code cleanup and move function to test helper file * Address most feedback. Pending refactor of issue certificate card! * Add integration test * Moves form to SelectableCard and add tests * Add jsdoc props to SelectableCard and fix placeholder * Move back SelectableCard * Covert to typescript and finish up tests * Dont use try catch for hasConfig * Add overview card test * More overview card tests * Address feedback!
This commit is contained in:
31
ui/tests/helpers/pki/pki-run-commands.js
Normal file
31
ui/tests/helpers/pki/pki-run-commands.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import consoleClass from 'vault/tests/pages/components/console/ui-panel';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
|
||||
const consoleComponent = create(consoleClass);
|
||||
|
||||
export const tokenWithPolicy = async function (name, policy) {
|
||||
await consoleComponent.runCommands([
|
||||
`write sys/policies/acl/${name} policy=${btoa(policy)}`,
|
||||
`write -field=client_token auth/token/create policies=${name}`,
|
||||
]);
|
||||
return consoleComponent.lastLogOutput;
|
||||
};
|
||||
|
||||
export const runCommands = async function (commands) {
|
||||
try {
|
||||
await consoleComponent.runCommands(commands);
|
||||
const res = consoleComponent.lastLogOutput;
|
||||
if (res.includes('Error')) {
|
||||
throw new Error(res);
|
||||
}
|
||||
return res;
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`The following occurred when trying to run the command(s):\n ${commands.join('\n')} \n\n ${
|
||||
consoleComponent.lastLogOutput
|
||||
}`
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user