refactor: 💡 implement new pathing for roles

This commit is contained in:
Randall Morey committed 2020-09-10 11:03:44 -04:00
1 parent 4a63c6484f
commit 76fe50c9e3
14 files changed
+75 -31

No files matched your search

@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Adapter | role', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let adapter = this.owner.lookup('adapter:role');
assert.ok(adapter);
});
});
+4 -4
View File
@@ -14,7 +14,7 @@ module('Unit | Model | role', function (hooks) {
test('it has a `saveGrants` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post('/v1/scopes/o_1/roles/123abc:set-grants', (schema, request) => {
this.server.post('/v1/roles/123abc:set-grants', (schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
grant_strings: ['grant1', 'grant2'],
@@ -44,7 +44,7 @@ module('Unit | Model | role', function (hooks) {
test('it has an `addPrincipals` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post('/v1/scopes/o_1/roles/123abc:add-principals', (schema, request) => {
this.server.post('/v1/roles/123abc:add-principals', (schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
principal_ids: ['123_abc', 'foobar'],
@@ -77,7 +77,7 @@ module('Unit | Model | role', function (hooks) {
test('it has a `removePrincipals` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post('/v1/scopes/o_1/roles/123abc:remove-principals', (schema, request) => {
this.server.post('/v1/roles/123abc:remove-principals', (schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
principal_ids: ['1', '3'],
@@ -110,7 +110,7 @@ module('Unit | Model | role', function (hooks) {
test('it has a `removePrincipal` method that deletes a single principal using `removePrincipals` method', async function (assert) {
assert.expect(1);
this.server.post('/v1/scopes/o_1/roles/123abc:remove-principals', (schema, request) => {
this.server.post('/v1/roles/123abc:remove-principals', (schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
principal_ids: ['3'],