2018-09-25 16:28:26 +00:00
|
|
|
import { run } from '@ember/runloop';
|
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupTest } from 'ember-qunit';
|
2018-06-14 04:06:19 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
module('Unit | Model | secret-engine', function(hooks) {
|
|
|
|
setupTest(hooks);
|
2018-06-14 04:06:19 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('modelTypeForKV is secret by default', function(assert) {
|
|
|
|
let model;
|
|
|
|
run(() => {
|
|
|
|
model = run(() => this.owner.lookup('service:store').createRecord('secret-engine'));
|
|
|
|
assert.equal(model.get('modelTypeForKV'), 'secret');
|
|
|
|
});
|
2018-06-14 04:06:19 +00:00
|
|
|
});
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('modelTypeForKV is secret-v2 for kv v2', function(assert) {
|
|
|
|
let model;
|
|
|
|
run(() => {
|
|
|
|
model = run(() =>
|
|
|
|
this.owner.lookup('service:store').createRecord('secret-engine', {
|
|
|
|
options: { version: 2 },
|
|
|
|
type: 'kv',
|
|
|
|
})
|
|
|
|
);
|
|
|
|
assert.equal(model.get('modelTypeForKV'), 'secret-v2');
|
2018-06-14 04:06:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('modelTypeForKV is secret-v2 for generic v2', function(assert) {
|
|
|
|
let model;
|
|
|
|
run(() => {
|
|
|
|
model = run(() =>
|
|
|
|
this.owner.lookup('service:store').createRecord('secret-engine', {
|
|
|
|
options: { version: 2 },
|
|
|
|
type: 'kv',
|
|
|
|
})
|
|
|
|
);
|
|
|
|
assert.equal(model.get('modelTypeForKV'), 'secret-v2');
|
2018-06-14 04:06:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|