7070from nova .tests .unit import fake_block_device
7171from nova .tests .unit import fake_flavor
7272from nova .tests .unit import fake_instance
73- from nova .tests .unit .image import fake
7473from nova .tests .unit import matchers
7574from nova import utils as nova_utils
7675
@@ -228,7 +227,7 @@ def setUp(self):
228227 super (ControllerTest , self ).setUp ()
229228 fakes .stub_out_nw_api (self )
230229 fakes .stub_out_key_pair_funcs (self )
231- fake . stub_out_image_service ( self )
230+ self . useFixture ( nova_fixtures . GlanceFixture ( self ) )
232231 fakes .stub_out_secgroup_api (
233232 self , security_groups = [{'name' : 'default' }])
234233 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):
30663065 self .controller ._action_rebuild , self .req ,
30673066 FAKE_UUID , body = self .body )
30683067
3069- @mock .patch .object (fake . _FakeImageService , 'show' ,
3068+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
30703069 return_value = dict (
30713070 id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
30723071 name = 'public image' , is_public = True ,
@@ -3082,7 +3081,7 @@ def test_rebuild_instance_fails_when_min_ram_too_small(self, mock_show):
30823081 self .req .environ ['nova.context' ], self .image_uuid ,
30833082 include_locations = False , show_deleted = True )
30843083
3085- @mock .patch .object (fake . _FakeImageService , 'show' ,
3084+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
30863085 return_value = dict (
30873086 id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
30883087 name = 'public image' , is_public = True ,
@@ -3098,7 +3097,7 @@ def test_rebuild_instance_fails_when_min_disk_too_small(self, mock_show):
30983097 self .req .environ ['nova.context' ], self .image_uuid ,
30993098 include_locations = False , show_deleted = True )
31003099
3101- @mock .patch .object (fake . _FakeImageService , 'show' ,
3100+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
31023101 return_value = dict (
31033102 id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
31043103 name = 'public image' , is_public = True ,
@@ -3120,7 +3119,7 @@ def test_rebuild_instance_name_all_blank(self):
31203119 self .controller ._action_rebuild ,
31213120 self .req , FAKE_UUID , body = self .body )
31223121
3123- @mock .patch .object (fake . _FakeImageService , 'show' ,
3122+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
31243123 return_value = dict (
31253124 id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
31263125 name = 'public image' , is_public = True ,
@@ -3140,7 +3139,7 @@ def fake_get_image(self, context, image_href, **kwargs):
31403139 name = 'public image' , is_public = True , status = 'active' )
31413140
31423141 with test .nested (
3143- mock .patch .object (fake . _FakeImageService , 'show' ,
3142+ mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
31443143 side_effect = fake_get_image ),
31453144 mock .patch .object (self .controller .compute_api , 'rebuild' ,
31463145 side_effect = exception .OnsetFileLimitExceeded )
@@ -4251,7 +4250,7 @@ def server_update_and_get_original(
42514250 return (inst , inst )
42524251
42534252 fakes .stub_out_key_pair_funcs (self )
4254- fake . stub_out_image_service ( self )
4253+ self . useFixture ( nova_fixtures . GlanceFixture ( self ) )
42554254 self .stub_out ('nova.db.api.instance_create' , instance_create )
42564255 self .stub_out ('nova.db.api.instance_system_metadata_update' ,
42574256 lambda * a , ** kw : None )
@@ -4384,7 +4383,7 @@ def test_create_server_image_too_large(self):
43844383 "Flavor's disk is too small for requested image." ):
43854384 self .controller .create (self .req , body = self .body )
43864385
4387- @mock .patch .object (fake . _FakeImageService , 'show' ,
4386+ @mock .patch .object (nova_fixtures . GlanceFixture , 'show' ,
43884387 return_value = dict (
43894388 id = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6' ,
43904389 status = 'active' ,
0 commit comments