mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-17 12:07:02 +02:00
* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
92 lines
3.2 KiB
JavaScript
92 lines
3.2 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { click, fillIn, findAll, currentURL, find, settled, waitUntil } 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';
|
|
|
|
module('Acceptance | aws secret backend', function (hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.uid = uuidv4();
|
|
return authPage.login();
|
|
});
|
|
|
|
test('aws backend', async function (assert) {
|
|
assert.expect(12);
|
|
const path = `aws-${this.uid}`;
|
|
const roleName = 'awsrole';
|
|
|
|
await enablePage.enable('aws', path);
|
|
await settled();
|
|
await click('[data-test-configuration-tab]');
|
|
|
|
await click('[data-test-secret-backend-configure]');
|
|
|
|
assert.strictEqual(currentURL(), `/vault/settings/secrets/configure/${path}`);
|
|
assert.ok(findAll('[data-test-aws-root-creds-form]').length, 'renders the empty root creds form');
|
|
assert.ok(findAll('[data-test-aws-link="root-creds"]').length, 'renders the root creds link');
|
|
assert.ok(findAll('[data-test-aws-link="leases"]').length, 'renders the leases config link');
|
|
|
|
await fillIn('[data-test-aws-input="accessKey"]', 'foo');
|
|
await fillIn('[data-test-aws-input="secretKey"]', 'bar');
|
|
|
|
await click('[data-test-aws-input="root-save"]');
|
|
|
|
assert.ok(
|
|
find('[data-test-flash-message]').textContent.trim(),
|
|
`The backend configuration saved successfully!`
|
|
);
|
|
|
|
await click('[data-test-aws-link="leases"]');
|
|
|
|
await click('[data-test-aws-input="lease-save"]');
|
|
|
|
assert.ok(
|
|
find('[data-test-flash-message]').textContent.trim(),
|
|
`The backend configuration saved successfully!`
|
|
);
|
|
|
|
await click('[data-test-backend-view-link]');
|
|
|
|
assert.strictEqual(currentURL(), `/vault/secrets/${path}/list`, `navigates to the roles list`);
|
|
|
|
await click('[data-test-secret-create]');
|
|
|
|
assert.ok(
|
|
find('[data-test-secret-header]').textContent.includes('AWS Role'),
|
|
`aws: renders the create page`
|
|
);
|
|
|
|
await fillIn('[data-test-input="name"]', roleName);
|
|
|
|
// save the role
|
|
await click('[data-test-role-aws-create]');
|
|
await waitUntil(() => currentURL() === `/vault/secrets/${path}/show/${roleName}`); // flaky without this
|
|
assert.strictEqual(
|
|
currentURL(),
|
|
`/vault/secrets/${path}/show/${roleName}`,
|
|
`$aws: navigates to the show page on creation`
|
|
);
|
|
|
|
await click('[data-test-secret-root-link]');
|
|
|
|
assert.strictEqual(currentURL(), `/vault/secrets/${path}/list`);
|
|
assert.ok(findAll(`[data-test-secret-link="${roleName}"]`).length, `aws: role shows in the list`);
|
|
|
|
//and delete
|
|
await click(`[data-test-secret-link="${roleName}"] [data-test-popup-menu-trigger]`);
|
|
await waitUntil(() => find(`[data-test-aws-role-delete="${roleName}"]`)); // flaky without
|
|
await click(`[data-test-aws-role-delete="${roleName}"]`);
|
|
await click(`[data-test-confirm-button]`);
|
|
assert.dom(`[data-test-secret-link="${roleName}"]`).doesNotExist(`aws: role is no longer in the list`);
|
|
});
|
|
});
|