open-vault/ui/tests/unit/adapters/identity/entity-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

31 lines
946 B
JavaScript

import { moduleFor, test } from 'ember-qunit';
import testCases from './_test-cases';
import apiStub from 'vault/tests/helpers/noop-all-api-requests';
moduleFor('adapter:identity/entity', 'Unit | Adapter | identity/entity', {
needs: ['service:auth', 'service:flash-messages'],
beforeEach() {
this.server = apiStub();
},
afterEach() {
this.server.shutdown();
},
});
const cases = testCases('identit/entity');
cases.forEach(testCase => {
test(`entity#${testCase.adapterMethod}`, function(assert) {
assert.expect(2);
let adapter = this.subject();
adapter[testCase.adapterMethod](...testCase.args);
let { url, method } = this.server.handledRequests[0];
assert.equal(url, testCase.url, `${testCase.adapterMethod} calls the correct url: ${testCase.url}`);
assert.equal(
method,
testCase.method,
`${testCase.adapterMethod} uses the correct http verb: ${testCase.method}`
);
});
});