Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI - fix cubbyhole #4851

Merged
merged 2 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ui/app/routes/vault/cluster/secrets/backend/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ var SecretProxy = Ember.Object.extend(KeyMixin, {
let backendModel = this.store.peekRecord('secret-engine', backend);
return this.store.createRecord(backendModel.get('modelTypeForKV'), this.toModel());
},

willDestroy() {
this.store = null;
},
});

export default EditBase.extend({
Expand Down
1 change: 1 addition & 0 deletions ui/app/routes/vault/cluster/secrets/backend/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default Ember.Route.extend({
aws: 'role-aws',
pki: tab === 'certs' ? 'pki-certificate' : 'role-pki',
// secret or secret-v2
cubbyhole: 'secret',
kv: backendModel.get('modelTypeForKV'),
generic: backendModel.get('modelTypeForKV'),
};
Expand Down
1 change: 1 addition & 0 deletions ui/app/routes/vault/cluster/secrets/backend/secret-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default Ember.Route.extend(UnloadModelRoute, {
ssh: 'role-ssh',
aws: 'role-aws',
pki: secret && secret.startsWith('cert/') ? 'pki-certificate' : 'role-pki',
cubbyhole: 'secret',
kv: backendModel.get('modelTypeForKV'),
generic: backendModel.get('modelTypeForKV'),
};
Expand Down
40 changes: 40 additions & 0 deletions ui/tests/acceptance/secrets/backend/cubbyhole/secret-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { test } from 'qunit';
import moduleForAcceptance from 'vault/tests/helpers/module-for-acceptance';
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 { create } from 'ember-cli-page-object';

import apiStub from 'vault/tests/helpers/noop-all-api-requests';

moduleForAcceptance('Acceptance | secrets/cubbyhole/create', {
beforeEach() {
this.server = apiStub({ usePassthrough: true });
return authLogin();
},
afterEach() {
this.server.shutdown();
},
});

test('it creates and can view a secret with the cubbyhole backend', function(assert) {
const kvPath = `cubbyhole-kv-${new Date().getTime()}`;
listPage.visitRoot({ backend: 'cubbyhole' });
andThen(() => {
assert.equal(currentRouteName(), 'vault.cluster.secrets.backend.list-root', 'navigates to the list page');
});

listPage.create();
editPage.createSecret(kvPath, 'foo', 'bar');
andThen(() => {
let capabilitiesReq = this.server.passthroughRequests.findBy('url', '/v1/sys/capabilities-self');
assert.equal(
JSON.parse(capabilitiesReq.requestBody).paths,
`cubbyhole/${kvPath}`,
'calls capabilites with the correct path'
);
assert.equal(currentRouteName(), 'vault.cluster.secrets.backend.show', 'redirects to the show page');
assert.ok(showPage.editIsPresent, 'shows the edit button');
});
});