launch-instance-model.service.spec.js (horizon-18.6.2) | : | launch-instance-model.service.spec.js (horizon-18.6.3) | ||
---|---|---|---|---|
skipping to change at line 134 | skipping to change at line 134 | |||
deferred.resolve({ data: { items: ports[network.network_id] } }); | deferred.resolve({ data: { items: ports[network.network_id] } }); | |||
return deferred.promise; | return deferred.promise; | |||
} | } | |||
}; | }; | |||
beforeEach(module('horizon.dashboard.project.workflow.launch-instance')); | beforeEach(module('horizon.dashboard.project.workflow.launch-instance')); | |||
beforeEach(module(function($provide) { | beforeEach(module(function($provide) { | |||
$provide.value('horizon.app.core.openstack-service-api.glance', { | $provide.value('horizon.app.core.openstack-service-api.glance', { | |||
getImages: function () { | getImages: function (params) { | |||
var images = [ | var images; | |||
{container_format: 'aki', properties: {}}, | if (params.visibility === 'community') { | |||
{container_format: 'ari', properties: {}}, | images = [ | |||
{container_format: 'ami', properties: {}}, | {id: '10', container_format: 'raw', properties: {image_type: 'im | |||
{container_format: 'raw', properties: {}}, | age'}, | |||
{container_format: 'ami', properties: {image_type: 'image'}}, | visibility: 'community'}, | |||
{container_format: 'raw', properties: {image_type: 'image'}}, | // ID 6 is already returned by the first call (below), so this s | |||
{container_format: 'ami', properties: { | hould be ignored. | |||
block_device_mapping: '[{"source_type": "snapshot"}]'}}, | // To clarify the difference, the content here is different inte | |||
{container_format: 'raw', properties: { | ntionally. | |||
block_device_mapping: '[{"source_type": "snapshot"}]'}} | {id: '6', container_format: 'raw', properties: {image_type: 'ima | |||
]; | ge'}, | |||
visibility: 'community'} | ||||
]; | ||||
} else { | ||||
images = [ | ||||
// container_format aki and ari are not considered as bootable | ||||
{id: '1', container_format: 'aki', properties: {}}, | ||||
{id: '2', container_format: 'ari', properties: {}}, | ||||
// The following images are considered as "image" sources. | ||||
{id: '3', container_format: 'ami', properties: {}, name: 'ami_im | ||||
age'}, | ||||
{id: '4', container_format: 'raw', properties: {}, name: 'raw_im | ||||
age'}, | ||||
{id: '5', container_format: 'ami', properties: {image_type: 'ima | ||||
ge'}}, | ||||
{id: '6', container_format: 'raw', properties: {image_type: 'ima | ||||
ge'}}, | ||||
// The following images are considered as "snapshot" sources. | ||||
{id: '7', container_format: 'ami', | ||||
properties: {block_device_mapping: '[{"source_type": "snapshot" | ||||
}]'}}, | ||||
{id: '8', container_format: 'raw', | ||||
properties: {block_device_mapping: '[{"source_type": "snapshot" | ||||
}]'}}, | ||||
{id: '9', container_format: 'raw', properties: {image_type: 'sna | ||||
pshot'}} | ||||
]; | ||||
} | ||||
var deferred = $q.defer(); | var deferred = $q.defer(); | |||
deferred.resolve({data: {items: images}}); | deferred.resolve({data: {items: images}}); | |||
return deferred.promise; | return deferred.promise; | |||
}, | }, | |||
getNamespaces: function () { | getNamespaces: function () { | |||
var namespaces = ['ns-1', 'ns-2']; | var namespaces = ['ns-1', 'ns-2']; | |||
var deferred = $q.defer(); | var deferred = $q.defer(); | |||
skipping to change at line 390 | skipping to change at line 406 | |||
it('should init model with no networks/volumes if neutron & cinder disab led', function() { | it('should init model with no networks/volumes if neutron & cinder disab led', function() { | |||
model.initialize(true); | model.initialize(true); | |||
scope.$apply(); | scope.$apply(); | |||
expect(model.initializing).toBe(false); | expect(model.initializing).toBe(false); | |||
expect(model.initialized).toBe(true); | expect(model.initialized).toBe(true); | |||
expect(model.newInstanceSpec).toBeDefined(); | expect(model.newInstanceSpec).toBeDefined(); | |||
var expectedImages = [ | var expectedImages = [ | |||
{container_format: 'ami', properties: {}}, | {id: '3', container_format: 'ami', properties: {}, name: 'ami_image' | |||
{container_format: 'raw', properties: {}}, | , | |||
{container_format: 'ami', properties: {image_type: 'image'}}, | name_or_id: 'ami_image'}, | |||
{container_format: 'raw', properties: {image_type: 'image'}} | {id: '4', container_format: 'raw', properties: {}, name: 'raw_image' | |||
, | ||||
name_or_id: 'raw_image'}, | ||||
{id: '5', container_format: 'ami', properties: {image_type: 'image'} | ||||
, name_or_id: '5'}, | ||||
{id: '6', container_format: 'raw', properties: {image_type: 'image'} | ||||
, name_or_id: '6'}, | ||||
{id: '10', container_format: 'raw', properties: {image_type: 'image' | ||||
}, name_or_id: '10', | ||||
visibility: 'community'} | ||||
]; | ]; | |||
expect(model.images).toEqual(expectedImages); | expect(model.images).toEqual(expectedImages); | |||
var expectedSnapshots = [ | var expectedSnapshots = [ | |||
{ | {id: '7', container_format: 'ami', | |||
container_format: 'ami', | properties: {block_device_mapping: '[{"source_type": "snapshot"}]'} | |||
properties: {block_device_mapping: '[{"source_type": "snapshot"}]' | }, | |||
} | {id: '8', container_format: 'raw', | |||
}, | properties: {block_device_mapping: '[{"source_type": "snapshot"}]'} | |||
{ | }, | |||
container_format: 'raw', | {id: '9', container_format: 'raw', properties: {image_type: 'snapsho | |||
properties: {block_device_mapping: '[{"source_type": "snapshot"}]' | t'}} | |||
} | ||||
} | ||||
]; | ]; | |||
expect(model.imageSnapshots).toEqual(expectedSnapshots); | expect(model.imageSnapshots).toEqual(expectedSnapshots); | |||
var expectedZones = [ | var expectedZones = [ | |||
{'label': 'Any Availability Zone', 'value': ''}, | {'label': 'Any Availability Zone', 'value': ''}, | |||
{'label': 'zone-1', 'value': 'zone-1'}, | {'label': 'zone-1', 'value': 'zone-1'}, | |||
{'label': 'zone-2', 'value': 'zone-2'} | {'label': 'zone-2', 'value': 'zone-2'} | |||
]; | ]; | |||
expect(model.availabilityZones).toEqual(expectedZones); | expect(model.availabilityZones).toEqual(expectedZones); | |||
End of changes. 3 change blocks. | ||||
27 lines changed or deleted | 61 lines changed or added |