mirror of
https://github.com/status-im/consul.git
synced 2025-02-08 03:43:34 +00:00
482426b13e
Adds support for ACL Roles and Service Identities CRUD, along with necessary changes to Tokens, and the CSS improvements required. Also includes refinements/improvements for easier testing of deeply nested components. 1. ember-data adapter/serializer/model triplet for Roles 2. repository, form/validations and searching filter for Roles 3. Moves potentially, repeated, or soon to to repeated functionality into a mixin (mainly for 'many policy' relationships) 4. A few styling tweaks for little edge cases around roles 5. Router additions, Route, Controller and templates for Roles Also see: * UI: ACL Roles cont. plus Service Identities (#5661 and #5720)
71 lines
2.1 KiB
JavaScript
71 lines
2.1 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
import makeAttrable from 'consul-ui/utils/makeAttrable';
|
|
module('Integration | Adapter | role | url', function(hooks) {
|
|
setupTest(hooks);
|
|
const dc = 'dc-1';
|
|
const id = 'role-name';
|
|
test('urlForQuery returns the correct url', function(assert) {
|
|
const adapter = this.owner.lookup('adapter:role');
|
|
const expected = `/v1/acl/roles?dc=${dc}`;
|
|
const actual = adapter.urlForQuery({
|
|
dc: dc,
|
|
});
|
|
assert.equal(actual, expected);
|
|
});
|
|
test('urlForQueryRecord returns the correct url', function(assert) {
|
|
const adapter = this.owner.lookup('adapter:role');
|
|
const expected = `/v1/acl/role/${id}?dc=${dc}`;
|
|
const actual = adapter.urlForQueryRecord({
|
|
dc: dc,
|
|
id: id,
|
|
});
|
|
assert.equal(actual, expected);
|
|
});
|
|
test("urlForQueryRecord throws if you don't specify an id", function(assert) {
|
|
const adapter = this.owner.lookup('adapter:role');
|
|
assert.throws(function() {
|
|
adapter.urlForQueryRecord({
|
|
dc: dc,
|
|
});
|
|
});
|
|
});
|
|
test('urlForCreateRecord returns the correct url', function(assert) {
|
|
const adapter = this.owner.lookup('adapter:role');
|
|
const expected = `/v1/acl/role?dc=${dc}`;
|
|
const actual = adapter.urlForCreateRecord(
|
|
'role',
|
|
makeAttrable({
|
|
Datacenter: dc,
|
|
})
|
|
);
|
|
assert.equal(actual, expected);
|
|
});
|
|
test('urlForUpdateRecord returns the correct url', function(assert) {
|
|
const adapter = this.owner.lookup('adapter:role');
|
|
const expected = `/v1/acl/role/${id}?dc=${dc}`;
|
|
const actual = adapter.urlForUpdateRecord(
|
|
id,
|
|
'role',
|
|
makeAttrable({
|
|
Datacenter: dc,
|
|
ID: id,
|
|
})
|
|
);
|
|
assert.equal(actual, expected);
|
|
});
|
|
test('urlForDeleteRecord returns the correct url', function(assert) {
|
|
const adapter = this.owner.lookup('adapter:role');
|
|
const expected = `/v1/acl/role/${id}?dc=${dc}`;
|
|
const actual = adapter.urlForDeleteRecord(
|
|
id,
|
|
'role',
|
|
makeAttrable({
|
|
Datacenter: dc,
|
|
ID: id,
|
|
})
|
|
);
|
|
assert.equal(actual, expected);
|
|
});
|
|
});
|