2018-09-25 16:28:26 +00:00
|
|
|
import { click, fillIn, findAll, currentURL, visit } from '@ember/test-helpers';
|
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupApplicationTest } from 'ember-qunit';
|
2018-04-03 14:16:57 +00:00
|
|
|
import VAULT_KEYS from 'vault/tests/helpers/vault-keys';
|
2018-09-25 16:28:26 +00:00
|
|
|
import authPage from 'vault/tests/pages/auth';
|
|
|
|
import logout from 'vault/tests/pages/logout';
|
|
|
|
import { pollCluster } from 'vault/tests/helpers/poll-cluster';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
const { unseal } = VAULT_KEYS;
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
module('Acceptance | unseal', function(hooks) {
|
|
|
|
setupApplicationTest(hooks);
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
hooks.beforeEach(function() {
|
|
|
|
return authPage.login();
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
hooks.afterEach(function() {
|
|
|
|
return logout.visit();
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
2018-09-25 16:28:26 +00:00
|
|
|
|
|
|
|
test('seal then unseal', async function(assert) {
|
|
|
|
await visit('/vault/settings/seal');
|
|
|
|
assert.equal(currentURL(), '/vault/settings/seal');
|
|
|
|
|
|
|
|
// seal
|
|
|
|
await click('[data-test-seal] button');
|
|
|
|
await click('[data-test-confirm-button]');
|
|
|
|
await pollCluster(this.owner);
|
2018-04-03 14:16:57 +00:00
|
|
|
assert.equal(currentURL(), '/vault/unseal', 'vault is on the unseal page');
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
// unseal
|
|
|
|
await fillIn('[data-test-shamir-input]', unseal);
|
|
|
|
await click('button[type="submit"]');
|
|
|
|
await pollCluster(this.owner);
|
|
|
|
assert.equal(findAll('[data-test-cluster-status]').length, 0, 'ui does not show sealed warning');
|
2018-04-03 14:16:57 +00:00
|
|
|
assert.ok(currentURL().match(/\/vault\/auth/), 'vault is ready to authenticate');
|
|
|
|
});
|
|
|
|
});
|