Merge branch 'develop' into add-target-type

This commit is contained in:
Susmitha Girumala authored and GitHub committed 2020-09-11 10:23:41 -04:00
commit 610a2d1666
49 files changed
+312 -217

No files matched your search

@@ -0,0 +1,12 @@
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);
});
});
@@ -6,23 +6,17 @@ module('Unit | Adapter | host set', function(hooks) {
test('it generates correct complete URLs', function (assert) {
assert.expect(2);
const scopeID = 'o_1';
const hostCatalogID = 'hc_098';
const method = 'my-custom-method';
const mockSnapshot = {
adapterOptions: {
scopeID,
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/scopes/o_1/host-sets:my-custom-method');
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/scopes/o_1/host-catalogs/hc_098/host-sets:my-custom-method');
assert.equal(url, '/v1/host-sets:my-custom-method');
});
});
+3 -19
View File
@@ -4,25 +4,9 @@ import { setupTest } from 'ember-qunit';
module('Unit | Adapter | host', function(hooks) {
setupTest(hooks);
test('it generates correct complete URLs', function (assert) {
assert.expect(2);
const scopeID = 'o_1';
const hostCatalogID = 'hc_098';
const method = 'my-custom-method';
const mockSnapshot = {
adapterOptions: {
scopeID,
method
}
};
const adapter = this.owner.lookup('adapter:host');
// Without hostCatalogID...
let url = adapter.buildURL('host', null, mockSnapshot, 'findAll');
assert.equal(url, '/v1/scopes/o_1/hosts:my-custom-method');
// With hostCatalogID...
mockSnapshot.adapterOptions.hostCatalogID = hostCatalogID;
url = adapter.buildURL('host', null, mockSnapshot, 'findAll');
assert.equal(url, '/v1/scopes/o_1/host-catalogs/hc_098/hosts:my-custom-method');
test('it exists', function(assert) {
let adapter = this.owner.lookup('adapter:host');
assert.ok(adapter);
});
});
+11
View File
@@ -10,4 +10,15 @@ module('Unit | Model | host', function(hooks) {
let model = store.createRecord('host', {});
assert.ok(model);
});
test('it contains attributes', function(assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('host', {
type: 'static',
attributes: {
address: '127.0.0.1'
}
});
assert.equal(model.attributes.address, '127.0.0.1');
});
});
@@ -0,0 +1,23 @@
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);
});
});
@@ -11,6 +11,7 @@ module('Unit | Serializer | host set', function(hooks) {
const record = store.createRecord('host-set', {
name: 'Host Set 1',
description: 'Description',
host_catalog_id: '123',
version: 1
});
const snapshot = record._createSnapshot();
@@ -19,6 +20,7 @@ module('Unit | Serializer | host set', function(hooks) {
assert.deepEqual(serializedRecord, {
name: 'Host Set 1',
description: 'Description',
host_catalog_id: '123',
version: 1
});
});
@@ -0,0 +1,23 @@
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);
});
});