mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 19:47:54 +00:00
* setup the toggle to display mount configuration options * whew.. getting there. aws only, borked for ssh * another round, better than before * masked things * changelog * fix broken oss test * move to component * handle ssh things and cleanup * wip test coverage * test coverage for the component * copywrite header miss * update no model error * setup configuration aws acceptance tests * update CONFIURABLE_SECRET_ENGINES * acceptance tests for aws * ssh configuration * clean up * remove comment * move to confirm model before destructuring * pr comments * fix check for ssh config error * add message check in api error test * pr comments
75 lines
2.9 KiB
JavaScript
75 lines
2.9 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { click, fillIn, currentURL, waitFor, visit } from '@ember/test-helpers';
|
|
import { module, test } from 'qunit';
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
import authPage from 'vault/tests/pages/auth';
|
|
import enablePage from 'vault/tests/pages/settings/mount-secret-backend';
|
|
import { runCmd } from 'vault/tests/helpers/commands';
|
|
import { GENERAL } from 'vault/tests/helpers/general-selectors';
|
|
import { SECRET_ENGINE_SELECTORS as SES } from 'vault/tests/helpers/secret-engine/secret-engine-selectors';
|
|
|
|
module('Acceptance | ssh | configuration', function (hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.uid = uuidv4();
|
|
return authPage.login();
|
|
});
|
|
|
|
test('it should prompt configuration after mounting ssh engine', async function (assert) {
|
|
const sshPath = `ssh-${this.uid}`;
|
|
// in this test go through the full mount process. Bypass this step in later tests.
|
|
await visit('/vault/settings/mount-secret-backend');
|
|
await click(SES.mountType('ssh'));
|
|
await fillIn(GENERAL.inputByAttr('path'), sshPath);
|
|
await click(SES.mountSubmit);
|
|
await click(SES.configTab);
|
|
assert.dom(GENERAL.emptyStateTitle).hasText('SSH not configured');
|
|
assert.dom(GENERAL.emptyStateActions).hasText('Configure SSH');
|
|
// cleanup
|
|
await runCmd(`delete sys/mounts/${sshPath}`);
|
|
});
|
|
|
|
test('it should show a public key after saving default configuration', async function (assert) {
|
|
const sshPath = `ssh-${this.uid}`;
|
|
await enablePage.enable('ssh', sshPath);
|
|
await click(SES.configTab);
|
|
await click(SES.configure);
|
|
assert.strictEqual(
|
|
currentURL(),
|
|
`/vault/settings/secrets/configure/${sshPath}`,
|
|
'transitions to the configuration page'
|
|
);
|
|
assert.dom(SES.ssh.configureForm).exists('renders ssh configuration form');
|
|
|
|
// default has generate CA checked so we just submit the form
|
|
await click(SES.ssh.sshInput('configure-submit'));
|
|
assert.strictEqual(
|
|
currentURL(),
|
|
`/vault/settings/secrets/configure/${sshPath}`,
|
|
'stays on configuration form page.'
|
|
);
|
|
|
|
await waitFor(SES.ssh.sshInput('public-key'));
|
|
assert.dom(SES.ssh.sshInput('public-key')).exists('renders the public key input on form page');
|
|
assert.dom(SES.ssh.sshInput('public-key')).hasClass('masked-input', 'public key is masked');
|
|
|
|
await click(SES.viewBackend);
|
|
await click(SES.configTab);
|
|
assert
|
|
.dom(`[data-test-value-div="Public key"] [data-test-masked-input]`)
|
|
.hasText('***********', 'value for Public key is on config details and is masked');
|
|
assert
|
|
.dom(GENERAL.infoRowValue('Generate signing key'))
|
|
.hasText('Yes', 'value for Generate signing key displays default of true/yes.');
|
|
// cleanup
|
|
await runCmd(`delete sys/mounts/${sshPath}`);
|
|
});
|
|
});
|