Merge branch 'develop' into add-target-type
This commit is contained in:
62 files changed
+47
-734
No files matched your search
@@ -24,29 +24,6 @@ module('Unit | Adapter | application', function (hooks) {
|
||||
assert.equal(adapter.urlPrefix(), config.api.namespace);
|
||||
});
|
||||
|
||||
test('it generates URL prefixes with optional `scopeID` from adapterOptions', function (assert) {
|
||||
assert.expect(2);
|
||||
const scopeID = 'global';
|
||||
const adapter = this.owner.lookup('adapter:application');
|
||||
const prefix = adapter.urlPrefix(null, null, null, null, {
|
||||
adapterOptions: { scopeID }
|
||||
});
|
||||
assert.ok(config.api.namespace);
|
||||
assert.equal(prefix, `v1/scopes/${scopeID}`);
|
||||
});
|
||||
|
||||
test('it does not prefix URLs with `scopeID` when hasScopePrefix is `false`', function (assert) {
|
||||
assert.expect(2);
|
||||
const scopeID = 'global';
|
||||
const adapter = this.owner.lookup('adapter:application');
|
||||
adapter.hasScopePrefix = false;
|
||||
const prefix = adapter.urlPrefix(null, null, null, null, {
|
||||
adapterOptions: { scopeID }
|
||||
});
|
||||
assert.ok(config.api.namespace);
|
||||
assert.equal(prefix, 'v1');
|
||||
});
|
||||
|
||||
test('it generates correct default URL suffixes', function (assert) {
|
||||
assert.expect(1);
|
||||
const adapter = this.owner.lookup('adapter:application');
|
||||
@@ -77,17 +54,17 @@ module('Unit | Adapter | application', function (hooks) {
|
||||
const adapter = this.owner.lookup('adapter:application');
|
||||
// test URL generation for each request type...
|
||||
const findRecordURL = adapter.buildURL('user', '1', mockSnapshot, 'findRecord');
|
||||
assert.equal(findRecordURL, '/v1/scopes/o_1/users/1:my-custom-method');
|
||||
assert.equal(findRecordURL, '/v1/users/1:my-custom-method');
|
||||
const findAllURL = adapter.buildURL('user', null, mockSnapshot, 'findAll');
|
||||
assert.equal(findAllURL, '/v1/scopes/o_1/users:my-custom-method');
|
||||
assert.equal(findAllURL, '/v1/users:my-custom-method');
|
||||
const findBelongsToURL = adapter.buildURL('user', '2', mockSnapshot, 'findBelongsTo');
|
||||
assert.equal(findBelongsToURL, '/v1/scopes/o_1/users/2:my-custom-method');
|
||||
assert.equal(findBelongsToURL, '/v1/users/2:my-custom-method');
|
||||
const createRecordURL = adapter.buildURL('user', null, mockSnapshot, 'createRecord');
|
||||
assert.equal(createRecordURL, '/v1/scopes/o_1/users:my-custom-method');
|
||||
assert.equal(createRecordURL, '/v1/users:my-custom-method');
|
||||
const updateRecordURL = adapter.buildURL('user', '3', mockSnapshot, 'updateRecord');
|
||||
assert.equal(updateRecordURL, '/v1/scopes/o_1/users/3:my-custom-method');
|
||||
assert.equal(updateRecordURL, '/v1/users/3:my-custom-method');
|
||||
const deleteRecordURL = adapter.buildURL('user', '4', mockSnapshot, 'deleteRecord');
|
||||
assert.equal(deleteRecordURL, '/v1/scopes/o_1/users/4:my-custom-method');
|
||||
assert.equal(deleteRecordURL, '/v1/users/4:my-custom-method');
|
||||
});
|
||||
|
||||
test('it can request records through the store from a specified scope', async function (assert) {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | auth method', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:auth-method');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | group', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:group');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | host catalog', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:host-catalog');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | host set', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it generates correct complete URLs', function (assert) {
|
||||
assert.expect(2);
|
||||
const hostCatalogID = 'hc_098';
|
||||
const method = 'my-custom-method';
|
||||
const mockSnapshot = { adapterOptions: { method } };
|
||||
const adapter = this.owner.lookup('adapter:host-set');
|
||||
// Without hostCatalogID...
|
||||
let url = adapter.buildURL('host-set', null, mockSnapshot, 'findAll');
|
||||
assert.equal(url, '/v1/host-sets:my-custom-method');
|
||||
// With hostCatalogID...
|
||||
mockSnapshot.adapterOptions.hostCatalogID = hostCatalogID;
|
||||
url = adapter.buildURL('host-set', null, mockSnapshot, 'findAll');
|
||||
assert.equal(url, '/v1/host-sets:my-custom-method');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | host', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:host');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
|
||||
module('Unit | Adapter | scope', function(hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
test('it does not prefix URLs with `scopeID` for scope resources', function (assert) {
|
||||
assert.expect(1);
|
||||
const scopeID = 'global';
|
||||
const adapter = this.owner.lookup('adapter:scope');
|
||||
const prefix = adapter.urlPrefix(null, null, 'scope', null, {
|
||||
adapterOptions: { scopeID }
|
||||
});
|
||||
assert.equal(prefix, `v1`);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | target', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:target');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | user', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:user');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
});
|
||||
@@ -30,11 +30,9 @@ module('Unit | Serializer | application', function (hooks) {
|
||||
});
|
||||
});
|
||||
|
||||
test('it does not serialize scope_id when serializeScopeID is false', function (assert) {
|
||||
assert.expect(2);
|
||||
test('it serializes scope_id when scope is set', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('user');
|
||||
serializer.serializeScopeID = false;
|
||||
const record = store.createRecord('user', {
|
||||
name: 'User',
|
||||
description: 'Description',
|
||||
@@ -44,28 +42,6 @@ module('Unit | Serializer | application', function (hooks) {
|
||||
}
|
||||
});
|
||||
const serializedRecord = record.serialize();
|
||||
assert.equal(serializer.serializeScopeID, false);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
name: 'User',
|
||||
description: 'Description'
|
||||
});
|
||||
});
|
||||
|
||||
test('it does serialize scope_id when serializeScopeID is true', function (assert) {
|
||||
assert.expect(2);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('user');
|
||||
serializer.serializeScopeID = true;
|
||||
const record = store.createRecord('user', {
|
||||
name: 'User',
|
||||
description: 'Description',
|
||||
scope: {
|
||||
scope_id: 'global',
|
||||
type: 'global'
|
||||
}
|
||||
});
|
||||
const serializedRecord = record.serialize();
|
||||
assert.equal(serializer.serializeScopeID, true);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
name: 'User',
|
||||
description: 'Description',
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | auth method', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('auth-method');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('auth-method', {});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | host catalog', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('host-catalog');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('host-catalog', {});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | host', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('host');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('host', {});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | scope', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it serializes scope_id into payloads', function (assert) {
|
||||
assert.expect(2);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('scope');
|
||||
serializer.serializeScopeID = true;
|
||||
const record = store.createRecord('scope', {
|
||||
name: 'My Scope',
|
||||
description: 'Foo',
|
||||
type: 'org',
|
||||
scope: {
|
||||
scope_id: 'global',
|
||||
type: 'global'
|
||||
}
|
||||
});
|
||||
const serializedRecord = record.serialize();
|
||||
assert.equal(serializer.serializeScopeID, true);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
name: 'My Scope',
|
||||
description: 'Foo',
|
||||
type: 'org',
|
||||
scope_id: 'global'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | user', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('user');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('user', {});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user