|
|
|
@ -131,19 +131,35 @@
|
|
|
|
|
|
|
|
|
|
beforeEach(module(function($provide) { |
|
|
|
|
$provide.value('horizon.app.core.openstack-service-api.glance', { |
|
|
|
|
getImages: function () { |
|
|
|
|
var images = [ |
|
|
|
|
{container_format: 'aki', properties: {}}, |
|
|
|
|
{container_format: 'ari', properties: {}}, |
|
|
|
|
{container_format: 'ami', properties: {}}, |
|
|
|
|
{container_format: 'raw', properties: {}}, |
|
|
|
|
{container_format: 'ami', properties: {image_type: 'image'}}, |
|
|
|
|
{container_format: 'raw', properties: {image_type: 'image'}}, |
|
|
|
|
{container_format: 'ami', properties: { |
|
|
|
|
block_device_mapping: '[{"source_type": "snapshot"}]'}}, |
|
|
|
|
{container_format: 'raw', properties: { |
|
|
|
|
block_device_mapping: '[{"source_type": "snapshot"}]'}} |
|
|
|
|
]; |
|
|
|
|
getImages: function (params) { |
|
|
|
|
var images; |
|
|
|
|
if (params.visibility === 'community') { |
|
|
|
|
images = [ |
|
|
|
|
{id: '10', container_format: 'raw', properties: {image_type: 'image'}, |
|
|
|
|
visibility: 'community'}, |
|
|
|
|
// ID 6 is already returned by the first call (below), so this should be ignored.
|
|
|
|
|
// To clarify the difference, the content here is different intentionally.
|
|
|
|
|
{id: '6', container_format: 'raw', properties: {image_type: 'image'}, |
|
|
|
|
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_image'}, |
|
|
|
|
{id: '4', container_format: 'raw', properties: {}, name: 'raw_image'}, |
|
|
|
|
{id: '5', container_format: 'ami', properties: {image_type: 'image'}}, |
|
|
|
|
{id: '6', container_format: 'raw', properties: {image_type: 'image'}}, |
|
|
|
|
// 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: 'snapshot'}} |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var deferred = $q.defer(); |
|
|
|
|
deferred.resolve({data: {items: images}}); |
|
|
|
@ -386,22 +402,21 @@
|
|
|
|
|
expect(model.newInstanceSpec).toBeDefined(); |
|
|
|
|
|
|
|
|
|
var expectedImages = [ |
|
|
|
|
{container_format: 'ami', properties: {}}, |
|
|
|
|
{container_format: 'raw', properties: {}}, |
|
|
|
|
{container_format: 'ami', properties: {image_type: 'image'}}, |
|
|
|
|
{container_format: 'raw', properties: {image_type: 'image'}} |
|
|
|
|
{id: '3', container_format: 'ami', properties: {}, name: 'ami_image'}, |
|
|
|
|
{id: '4', container_format: 'raw', properties: {}, name: 'raw_image'}, |
|
|
|
|
{id: '5', container_format: 'ami', properties: {image_type: 'image'}}, |
|
|
|
|
{id: '6', container_format: 'raw', properties: {image_type: 'image'}}, |
|
|
|
|
{id: '10', container_format: 'raw', properties: {image_type: 'image'}, |
|
|
|
|
visibility: 'community'} |
|
|
|
|
]; |
|
|
|
|
expect(model.images).toEqual(expectedImages); |
|
|
|
|
|
|
|
|
|
var expectedSnapshots = [ |
|
|
|
|
{ |
|
|
|
|
container_format: 'ami', |
|
|
|
|
properties: {block_device_mapping: '[{"source_type": "snapshot"}]'} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
container_format: 'raw', |
|
|
|
|
properties: {block_device_mapping: '[{"source_type": "snapshot"}]'} |
|
|
|
|
} |
|
|
|
|
{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: 'snapshot'}} |
|
|
|
|
]; |
|
|
|
|
expect(model.imageSnapshots).toEqual(expectedSnapshots); |
|
|
|
|
|
|
|
|
|