70
70
from nova .tests .unit import fake_block_device
71
71
from nova .tests .unit import fake_flavor
72
72
from nova .tests .unit import fake_instance
73
- from nova .tests .unit .image import fake
74
73
from nova .tests .unit import matchers
75
74
from nova import utils as nova_utils
76
75
@@ -228,7 +227,7 @@ def setUp(self):
228
227
super (ControllerTest , self ).setUp ()
229
228
fakes .stub_out_nw_api (self )
230
229
fakes .stub_out_key_pair_funcs (self )
231
- fake . stub_out_image_service ( self )
230
+ self . useFixture ( nova_fixtures . GlanceFixture ( self ) )
232
231
fakes .stub_out_secgroup_api (
233
232
self , security_groups = [{'name' : 'default' }])
234
233
return_server = fakes .fake_compute_get (id = 2 , availability_zone = 'nova' ,
@@ -3066,7 +3065,7 @@ def test_rebuild_instance_with_metadata_value_not_string(self):
3066
3065
self .controller ._action_rebuild , self .req ,
3067
3066
FAKE_UUID , body = self .body )
3068
3067
3069
- @mock .patch .object (fake . _FakeImageService , 'show' ,
3068
+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
3070
3069
return_value = dict (
3071
3070
id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
3072
3071
name = 'public image' , is_public = True ,
@@ -3082,7 +3081,7 @@ def test_rebuild_instance_fails_when_min_ram_too_small(self, mock_show):
3082
3081
self .req .environ ['nova.context' ], self .image_uuid ,
3083
3082
include_locations = False , show_deleted = True )
3084
3083
3085
- @mock .patch .object (fake . _FakeImageService , 'show' ,
3084
+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
3086
3085
return_value = dict (
3087
3086
id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
3088
3087
name = 'public image' , is_public = True ,
@@ -3098,7 +3097,7 @@ def test_rebuild_instance_fails_when_min_disk_too_small(self, mock_show):
3098
3097
self .req .environ ['nova.context' ], self .image_uuid ,
3099
3098
include_locations = False , show_deleted = True )
3100
3099
3101
- @mock .patch .object (fake . _FakeImageService , 'show' ,
3100
+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
3102
3101
return_value = dict (
3103
3102
id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
3104
3103
name = 'public image' , is_public = True ,
@@ -3120,7 +3119,7 @@ def test_rebuild_instance_name_all_blank(self):
3120
3119
self .controller ._action_rebuild ,
3121
3120
self .req , FAKE_UUID , body = self .body )
3122
3121
3123
- @mock .patch .object (fake . _FakeImageService , 'show' ,
3122
+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
3124
3123
return_value = dict (
3125
3124
id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
3126
3125
name = 'public image' , is_public = True ,
@@ -3140,7 +3139,7 @@ def fake_get_image(self, context, image_href, **kwargs):
3140
3139
name = 'public image' , is_public = True , status = 'active' )
3141
3140
3142
3141
with test .nested (
3143
- mock .patch .object (fake . _FakeImageService , 'show' ,
3142
+ mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
3144
3143
side_effect = fake_get_image ),
3145
3144
mock .patch .object (self .controller .compute_api , 'rebuild' ,
3146
3145
side_effect = exception .OnsetFileLimitExceeded )
@@ -4251,7 +4250,7 @@ def server_update_and_get_original(
4251
4250
return (inst , inst )
4252
4251
4253
4252
fakes .stub_out_key_pair_funcs (self )
4254
- fake . stub_out_image_service ( self )
4253
+ self . useFixture ( nova_fixtures . GlanceFixture ( self ) )
4255
4254
self .stub_out ('nova.db.api.instance_create' , instance_create )
4256
4255
self .stub_out ('nova.db.api.instance_system_metadata_update' ,
4257
4256
lambda * a , ** kw : None )
@@ -4384,7 +4383,7 @@ def test_create_server_image_too_large(self):
4384
4383
"Flavor's disk is too small for requested image." ):
4385
4384
self .controller .create (self .req , body = self .body )
4386
4385
4387
- @mock .patch .object (fake . _FakeImageService , 'show' ,
4386
+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
4388
4387
return_value = dict (
4389
4388
id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
4390
4389
status = 'active' ,
0 commit comments