@@ -189,7 +189,7 @@ def test_sort_image_locations_multistore_disabled(self):
189
189
'url' : 'rbd://cccccccc/images/id' ,
190
190
'metadata' : {'store' : 'rbd3' }
191
191
}]
192
- mp = "glance.common.utils.glance_store.get_store_from_store_identifier "
192
+ mp = "glance.common.utils.glance_store.get_store_weight "
193
193
with mock .patch (mp ) as mock_get_store :
194
194
utils .sort_image_locations (locations )
195
195
@@ -215,10 +215,9 @@ def test_sort_image_locations(self):
215
215
'url' : 'rbd://cccccccc/images/id' ,
216
216
'metadata' : {'store' : 'rbd3' }
217
217
}]
218
- mp = "glance.common.utils.glance_store.get_store_from_store_identifier "
218
+ mp = "glance.common.utils.glance_store.get_store_weight "
219
219
with mock .patch (mp ) as mock_get_store :
220
- mock_store = mock_get_store .return_value
221
- mock_store .weight = 100
220
+ mock_get_store .return_value = 100
222
221
utils .sort_image_locations (locations )
223
222
224
223
# Since 3 stores are configured, internal method will be called 3 times
@@ -243,7 +242,7 @@ def test_sort_image_locations_without_metadata(self):
243
242
'url' : 'rbd://cccccccc/images/id' ,
244
243
'metadata' : {}
245
244
}]
246
- mp = "glance.common.utils.glance_store.get_store_from_store_identifier "
245
+ mp = "glance.common.utils.glance_store.get_store_weight "
247
246
with mock .patch (mp ) as mock_get_store :
248
247
utils .sort_image_locations (locations )
249
248
@@ -270,10 +269,9 @@ def test_sort_image_locations_with_partial_metadata(self):
270
269
'url' : 'rbd://cccccccc/images/id' ,
271
270
'metadata' : {}
272
271
}]
273
- mp = "glance.common.utils.glance_store.get_store_from_store_identifier "
272
+ mp = "glance.common.utils.glance_store.get_store_weight "
274
273
with mock .patch (mp ) as mock_get_store :
275
- mock_store = mock_get_store .return_value
276
- mock_store .weight = 100
274
+ mock_get_store .return_value = 100
277
275
utils .sort_image_locations (locations )
278
276
279
277
# Since 3 stores are configured, but only one location has
@@ -300,7 +298,7 @@ def test_sort_image_locations_unknownscheme(self):
300
298
'url' : 'rbd://cccccccc/images/id' ,
301
299
'metadata' : {'store' : 'rbd3' }
302
300
}]
303
- mp = "glance.common.utils.glance_store.get_store_from_store_identifier "
301
+ mp = "glance.common.utils.glance_store.get_store_weight "
304
302
with mock .patch (mp ) as mock_get_store :
305
303
mock_get_store .side_effect = store .UnknownScheme ()
306
304
sorted_locations = utils .sort_image_locations (locations )
0 commit comments