mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
* adds pki certificate details page component * adds tests for pki base adapter * adds more comments * updates remaining pki/certificate model references to pki/certificate/base
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'vault/tests/helpers';
|
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
|
|
|
module('Unit | Adapter | pki/certificate/generate', function (hooks) {
|
|
setupTest(hooks);
|
|
setupMirage(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.store = this.owner.lookup('service:store');
|
|
this.secretMountPath = this.owner.lookup('service:secret-mount-path');
|
|
this.backend = 'pki-test';
|
|
this.secretMountPath.currentPath = this.backend;
|
|
this.data = {
|
|
serial_number: 'my-serial-number',
|
|
certificate: 'some-cert',
|
|
};
|
|
});
|
|
|
|
test('it should make request to correct endpoint on create', async function (assert) {
|
|
assert.expect(1);
|
|
const generateData = {
|
|
role: 'my-role',
|
|
common_name: 'example.com',
|
|
};
|
|
this.server.post(`${this.backend}/issue/${generateData.role}`, () => {
|
|
assert.ok(true, 'request made to correct endpoint on create');
|
|
return {
|
|
data: {
|
|
serial_number: 'this-serial-number',
|
|
},
|
|
};
|
|
});
|
|
|
|
const model = await this.store.createRecord('pki/certificate/generate', generateData);
|
|
await model.save();
|
|
});
|
|
});
|