2018-09-25 16:28:26 +00:00
|
|
|
import { currentRouteName } from '@ember/test-helpers';
|
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupApplicationTest } from 'ember-qunit';
|
2018-06-28 20:54:02 +00:00
|
|
|
import editPage from 'vault/tests/pages/secrets/backend/kv/edit-secret';
|
|
|
|
import showPage from 'vault/tests/pages/secrets/backend/kv/show';
|
|
|
|
import listPage from 'vault/tests/pages/secrets/backend/list';
|
|
|
|
import apiStub from 'vault/tests/helpers/noop-all-api-requests';
|
2018-09-25 16:28:26 +00:00
|
|
|
import authPage from 'vault/tests/pages/auth';
|
2018-06-28 20:54:02 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
module('Acceptance | secrets/cubbyhole/create', function(hooks) {
|
|
|
|
setupApplicationTest(hooks);
|
|
|
|
|
|
|
|
hooks.beforeEach(function() {
|
2018-06-28 20:54:02 +00:00
|
|
|
this.server = apiStub({ usePassthrough: true });
|
2018-09-25 16:28:26 +00:00
|
|
|
return authPage.login();
|
|
|
|
});
|
|
|
|
|
|
|
|
hooks.afterEach(function() {
|
2018-06-28 20:54:02 +00:00
|
|
|
this.server.shutdown();
|
2018-09-25 16:28:26 +00:00
|
|
|
});
|
2018-06-28 20:54:02 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('it creates and can view a secret with the cubbyhole backend', async function(assert) {
|
|
|
|
const kvPath = `cubbyhole-kv-${new Date().getTime()}`;
|
|
|
|
await listPage.visitRoot({ backend: 'cubbyhole' });
|
2018-06-28 20:54:02 +00:00
|
|
|
assert.equal(currentRouteName(), 'vault.cluster.secrets.backend.list-root', 'navigates to the list page');
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
await listPage.create();
|
|
|
|
await editPage.createSecret(kvPath, 'foo', 'bar');
|
2018-06-28 20:54:02 +00:00
|
|
|
assert.equal(currentRouteName(), 'vault.cluster.secrets.backend.show', 'redirects to the show page');
|
|
|
|
assert.ok(showPage.editIsPresent, 'shows the edit button');
|
|
|
|
});
|
|
|
|
});
|