mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
* upgrade ember-data 5.3.2, uninstall legacy compat, upgrade ember-cli, ember-source * use query instead of findAll for auth methods, update tests * set mutableId for kmip * show generated private key data before transitioning to details * update kv metadata test * remove deprecated methods from path help service * add changelog, update readme version matrix * remove toggle template helper
75 lines
3.0 KiB
JavaScript
75 lines
3.0 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { click, currentRouteName, fillIn, visit } from '@ember/test-helpers';
|
|
import { module, test } from 'qunit';
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
import { GENERAL } from 'vault/tests/helpers/general-selectors';
|
|
import { login } from 'vault/tests/helpers/auth/auth-helpers';
|
|
import { deleteAuthCmd, runCmd } from 'vault/tests/helpers/commands';
|
|
import { SECRET_ENGINE_SELECTORS as SES } from 'vault/tests/helpers/secret-engine/secret-engine-selectors';
|
|
|
|
module('Acceptance | settings/auth/enable', function (hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.uid = uuidv4();
|
|
return login();
|
|
});
|
|
|
|
test('it mounts and redirects', async function (assert) {
|
|
// always force the new mount to the top of the list
|
|
const path = `aaa-approle-${this.uid}`;
|
|
const type = 'approle';
|
|
await visit('/vault/settings/auth/enable');
|
|
assert.strictEqual(currentRouteName(), 'vault.cluster.settings.auth.enable');
|
|
await click(SES.mountType(type));
|
|
await fillIn(GENERAL.inputByAttr('path'), path);
|
|
await click(SES.mountSubmit);
|
|
assert
|
|
.dom(GENERAL.latestFlashContent)
|
|
.hasText(`Successfully mounted the ${type} auth method at ${path}.`);
|
|
assert.strictEqual(
|
|
currentRouteName(),
|
|
'vault.cluster.settings.auth.configure.section',
|
|
'redirects to the auth config page'
|
|
);
|
|
|
|
await visit('/vault/access/');
|
|
assert.dom(`[data-test-auth-backend-link=${path}]`).exists('mount is present in the list');
|
|
|
|
// cleanup
|
|
await runCmd(deleteAuthCmd(path));
|
|
});
|
|
|
|
test('it renders default config details', async function (assert) {
|
|
const path = `approle-config-${this.uid}`;
|
|
const type = 'approle';
|
|
await visit('/vault/settings/auth/enable');
|
|
await click(SES.mountType(type));
|
|
await fillIn(GENERAL.inputByAttr('path'), path);
|
|
await click(SES.mountSubmit);
|
|
// the config details is updated to query mount details from sys/internal/ui/mounts
|
|
// but we still want these forms to continue using sys/auth which returns 0 for default ttl values
|
|
// check tune form (right after enabling)
|
|
assert.dom(GENERAL.toggleInput('Default Lease TTL')).isNotChecked('default lease ttl is unset');
|
|
assert.dom(GENERAL.toggleInput('Max Lease TTL')).isNotChecked('max lease ttl is unset');
|
|
await click(GENERAL.breadcrumbAtIdx(1));
|
|
assert
|
|
.dom(GENERAL.infoRowValue('Default Lease TTL'))
|
|
.hasText('1 month 1 day', 'shows system default TTL');
|
|
assert.dom(GENERAL.infoRowValue('Max Lease TTL')).hasText('1 month 1 day', 'shows the proper max TTL');
|
|
|
|
// check edit form TTL values
|
|
await click('[data-test-configure-link]');
|
|
assert.dom(GENERAL.toggleInput('Default Lease TTL')).isNotChecked('default lease ttl is still unset');
|
|
assert.dom(GENERAL.toggleInput('Max Lease TTL')).isNotChecked('max lease ttl is still unset');
|
|
|
|
// cleanup
|
|
await runCmd(deleteAuthCmd(path));
|
|
});
|
|
});
|