Skip to content

Commit bac88e7

Browse files
Merge branch 'master' into jayasilan-issue2007
2 parents e807fd6 + 7b530a0 commit bac88e7

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

SoftLayer/managers/image.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def list_private_images(self, guid=None, name=None, limit=100, **kwargs):
6767

6868
kwargs['filter'] = _filter.to_dict()
6969

70-
account = self.client['Account']
71-
return account.getPrivateBlockDeviceTemplateGroups(**kwargs, limit=limit)
70+
return self.client.iter_call('SoftLayer_Account', 'getPrivateBlockDeviceTemplateGroups',
71+
filter=kwargs['filter'], mask=kwargs['mask'], limit=limit)
7272

7373
def list_public_images(self, guid=None, name=None, limit=100, **kwargs):
7474
"""List all public images.
@@ -89,7 +89,8 @@ def list_public_images(self, guid=None, name=None, limit=100, **kwargs):
8989

9090
kwargs['filter'] = _filter.to_dict()
9191

92-
return self.vgbdtg.getPublicImages(**kwargs, limit=limit)
92+
return self.client.iter_call('SoftLayer_Virtual_Guest_Block_Device_Template_Group', 'getPublicImages',
93+
filter=kwargs['filter'], mask=kwargs['mask'], limit=limit)
9394

9495
def _get_ids_from_name_public(self, name):
9596
"""Get public images which match the given name."""

tests/managers/image_tests.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,41 @@ def test_delete_image(self):
3333
self.assert_called_with(IMAGE_SERVICE, 'deleteObject', identifier=100)
3434

3535
def test_list_private_images(self):
36-
results = self.image.list_private_images()
37-
36+
# Casting to list() to force the iter_call generator to run
37+
results = list(self.image.list_private_images())
3838
self.assertEqual(len(results), 2)
39-
self.assert_called_with('SoftLayer_Account',
40-
'getPrivateBlockDeviceTemplateGroups')
39+
self.assert_called_with('SoftLayer_Account', 'getPrivateBlockDeviceTemplateGroups')
4140

4241
def test_list_private_images_with_filters(self):
43-
results = self.image.list_private_images(
44-
guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name')
42+
# Casting to list() to force the iter_call generator to run
43+
results = list(self.image.list_private_images(guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name'))
4544

46-
self.assertEqual(len(results), 2)
4745
_filter = {
4846
'privateBlockDeviceTemplateGroups': {
4947
'globalIdentifier': {
5048
'operation': '_= 0FA9ECBD-CF7E-4A1F-1E36F8D27C2B'},
5149
'name': {'operation': '_= name'}}
5250
}
53-
self.assert_called_with('SoftLayer_Account',
54-
'getPrivateBlockDeviceTemplateGroups',
55-
filter=_filter)
51+
self.assertEqual(len(results), 2)
52+
self.assert_called_with('SoftLayer_Account', 'getPrivateBlockDeviceTemplateGroups', filter=_filter)
5653

5754
def test_list_public_images(self):
58-
results = self.image.list_public_images()
59-
55+
# Casting to list() to force the iter_call generator to run
56+
results = list(self.image.list_public_images())
6057
self.assertEqual(len(results), 2)
6158
self.assert_called_with(IMAGE_SERVICE, 'getPublicImages')
6259

6360
def test_list_public_images_with_filters(self):
64-
results = self.image.list_public_images(
65-
guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name')
66-
61+
# Casting to list() to force the iter_call generator to run
62+
results = list(self.image.list_public_images(guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name'))
63+
self.assertEqual(len(results), 2)
6764
_filter = {
6865
'globalIdentifier': {
6966
'operation': '_= 0FA9ECBD-CF7E-4A1F-1E36F8D27C2B'},
7067
'name': {'operation': '_= name'}
7168
}
72-
self.assertEqual(len(results), 2)
73-
self.assert_called_with(IMAGE_SERVICE, 'getPublicImages',
74-
filter=_filter)
69+
70+
self.assert_called_with(IMAGE_SERVICE, 'getPublicImages', filter=_filter)
7571

7672
def test_resolve_ids_guid(self):
7773
result = self.image.resolve_ids('3C1F3C68-0B67-4F5E-8907-D0FC84BF3F12')

0 commit comments

Comments
 (0)