f3a8fdd4f0
* 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!
32 lines
956 B
JavaScript
32 lines
956 B
JavaScript
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;
|
|
}
|
|
};
|