open-vault/ui/tests/unit/adapters/secret-v2-test.js
Matthew Irish 7f4dbe3fd2
Ui kv v2 redux (#4393)
* remove header used for backwards compatibility in KV mounts, and use v1 paths for v1, v2 paths for v2

* make the model hook always run

* simplify adapter & serializer code for secrets

* update tests

* fix lease tests

* address review feedback
2018-04-19 21:26:25 -05:00

26 lines
893 B
JavaScript

import { moduleFor, test } from 'ember-qunit';
import Ember from 'ember';
moduleFor('adapter:secret-v2', 'Unit | Adapter | secret-v2', {
needs: ['service:auth', 'service:flash-messages'],
});
test('secret api urls', function(assert) {
let url, method, options;
let adapter = this.subject({
ajax: (...args) => {
[url, method, options] = args;
return Ember.RSVP.resolve({});
},
});
adapter.query({}, 'secret', { id: '', backend: 'secret' });
assert.equal(url, '/v1/secret/metadata/', 'query generic url OK');
assert.equal('GET', method, 'query generic method OK');
assert.deepEqual(options, { data: { list: true } }, 'query generic url OK');
adapter.queryRecord({}, 'secret', { id: 'foo', backend: 'secret' });
assert.equal(url, '/v1/secret/data/foo', 'queryRecord generic url OK');
assert.equal('GET', method, 'queryRecord generic method OK');
});