mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-20 22:21:09 +02:00
* move files around * move fetches to config to the configuration.index route * working... for aws, lots of clean up left * move error handling to parent route * standarize configModel param * add test coverage * welp a miss for non configurable engines * pr comments * remove mirage interrupts and test actual api * update configuration details test to test for template only things * api error coverage
52 lines
2.0 KiB
JavaScript
52 lines
2.0 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'vault/tests/helpers';
|
|
import { GENERAL } from 'vault/tests/helpers/general-selectors';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
import { CONFIGURABLE_SECRET_ENGINES } from 'vault/helpers/mountable-secret-engines';
|
|
import {
|
|
createConfig,
|
|
expectedConfigKeys,
|
|
expectedValueOfConfigKeys,
|
|
} from 'vault/tests/helpers/secret-engine/secret-engine-helpers';
|
|
|
|
module('Integration | Component | SecretEngine/configuration-details', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.store = this.owner.lookup('service:store');
|
|
this.configModels = [];
|
|
});
|
|
|
|
test('it shows prompt message if no config models are passed in', async function (assert) {
|
|
assert.expect(2);
|
|
await render(hbs`
|
|
<SecretEngine::ConfigurationDetails @typeDisplay="Display Name" />
|
|
`);
|
|
assert.dom(GENERAL.emptyStateTitle).hasText(`Display Name not configured`);
|
|
assert.dom(GENERAL.emptyStateMessage).hasText(`Get started by configuring your Display Name engine.`);
|
|
});
|
|
|
|
test('it shows config details if configModel(s) are passed in', async function (assert) {
|
|
assert.expect(14);
|
|
for (const type of CONFIGURABLE_SECRET_ENGINES) {
|
|
const backend = `test-${type}`;
|
|
this.configModels = createConfig(this.store, backend, type);
|
|
|
|
await render(hbs`<SecretEngine::ConfigurationDetails @configModels={{array this.configModels}}/>`);
|
|
for (const key of expectedConfigKeys(type)) {
|
|
assert.dom(GENERAL.infoRowLabel(key)).exists(`${key} on the ${type} config details exists.`);
|
|
const responseKeyAndValue = expectedValueOfConfigKeys(type, key);
|
|
assert
|
|
.dom(GENERAL.infoRowValue(key))
|
|
.hasText(responseKeyAndValue, `${key} value for the ${type} config details exists.`);
|
|
}
|
|
}
|
|
});
|
|
});
|