mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[openstack|compute] images collection should not return nil for #all
Fog::Compute[:openstack].images.all returns nil without the patch. The patch should bring the images collection behaviour in-line with other collections I think. The added test should expose the issue.
This commit is contained in:
parent
b3c851cd07
commit
8bb3e60aea
2 changed files with 16 additions and 1 deletions
|
@ -13,10 +13,11 @@ module Fog
|
|||
|
||||
def all
|
||||
data = service.list_images_detail.body['images']
|
||||
load(data)
|
||||
images = load(data)
|
||||
if server
|
||||
self.replace(self.select {|image| image.server_id == server.id})
|
||||
end
|
||||
images
|
||||
end
|
||||
|
||||
def get(image_id)
|
||||
|
|
14
tests/openstack/models/compute/images_tests.rb
Normal file
14
tests/openstack/models/compute/images_tests.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
Shindo.tests("Fog::Compute[:openstack] | images collection", ['openstack']) do
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests('#all').succeeds do
|
||||
fog = Fog::Compute[:openstack]
|
||||
test 'not nil' do
|
||||
fog.images.all.is_a? Array
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in a new issue