def setUp(self): super(QuotaSetsTest, self).setUp() self.controller = quotas.QuotaSetsController() self.user_id = 'fake' self.project_id = 'fake' self.user_context = context.RequestContext(self.user_id, self.project_id) self.admin_context = context.RequestContext(self.user_id, self.project_id, is_admin=True)
def setUp(self): super(VMWareAPIVMTestCase, self).setUp() self.context = context.RequestContext('fake', 'fake', is_admin=False) self.flags(vmwareapi_host_ip='test_url', vmwareapi_host_username='******', vmwareapi_host_password='******') self.user_id = 'fake' self.project_id = 'fake' self.context = context.RequestContext(self.user_id, self.project_id) self.network = utils.import_object(FLAGS.network_manager) vmwareapi_fake.reset() db_fakes.stub_out_db_instance_api(self.stubs) stubs.set_stubs(self.stubs) tank_stubs.stubout_tank_client(self.stubs) self.conn = vmwareapi_conn.get_connection(False) # NOTE(vish): none of the network plugging code is actually # being tested self.network_info = [({ 'bridge': 'fa0', 'id': 0, 'vlan': None, 'bridge_interface': None, 'injected': True }, { 'broadcast': '192.168.0.255', 'dns': ['192.168.0.1'], 'gateway': '192.168.0.1', 'gateway_v6': 'dead:beef::1', 'ip6s': [{ 'enabled': '1', 'ip': 'dead:beef::dcad:beff:feef:0', 'netmask': '64' }], 'ips': [{ 'enabled': '1', 'ip': '192.168.0.100', 'netmask': '255.255.255.0' }], 'label': 'fake', 'mac': 'DE:AD:BE:EF:00:00', 'rxtx_cap': 3 })] self.image = { 'id': 'c1c8ce3d-c2e0-4247-890c-ccf5cc1c004c', 'disk_format': 'vhd', 'size': 512, }
def setUp(self): super(SimpleTenantUsageTest, self).setUp() self.stubs.Set(api.API, "get_instance_type", fake_instance_type_get) self.stubs.Set(api.API, "get_active_by_window", fake_instance_get_active_by_window) self.admin_context = context.RequestContext('fakeadmin_0', 'faketenant_0', is_admin=True) self.user_context = context.RequestContext('fakeadmin_0', 'faketenant_0', is_admin=False) self.alt_user_context = context.RequestContext('fakeadmin_0', 'faketenant_1', is_admin=False) FLAGS.allow_admin_api = True
def test_schedule_happy_day(self): """Make sure there's nothing glaringly wrong with _schedule() by doing a happy day pass through.""" self.next_weight = 1.0 def _fake_weighted_sum(functions, hosts, options): self.next_weight += 2.0 host, hostinfo = hosts[0] return least_cost.WeightedHost(self.next_weight, host=host, hostinfo=hostinfo) sched = ds_fakes.FakeDistributedScheduler() fake_context = context.RequestContext('user', 'project') sched.zone_manager = ds_fakes.FakeZoneManager() self.stubs.Set(sched, '_filter_hosts', fake_filter_hosts) self.stubs.Set(least_cost, 'weighted_sum', _fake_weighted_sum) self.stubs.Set(engine.db, 'zone_get_all', fake_zone_get_all) self.stubs.Set(sched, '_call_zone_method', fake_call_zone_method) instance_type = dict(memory_mb=512, local_gb=512) request_spec = dict(num_instances=10, instance_type=instance_type) weighted_hosts = sched._schedule(fake_context, 'compute', request_spec) self.assertEquals(len(weighted_hosts), 10) for weighted_host in weighted_hosts: # We set this up so remote hosts have even weights ... if int(weighted_host.weight) % 2 == 0: self.assertTrue(weighted_host.zone is not None) self.assertTrue(weighted_host.host is None) else: self.assertTrue(weighted_host.host is not None) self.assertTrue(weighted_host.zone is None)
def test_schedule_local_zone(self): """Test to make sure _schedule makes no call out to zones if local_zone in the request spec is True.""" self.next_weight = 1.0 def _fake_weighted_sum(functions, hosts, options): self.next_weight += 2.0 host, hostinfo = hosts[0] return least_cost.WeightedHost(self.next_weight, host=host, hostinfo=hostinfo) sched = ds_fakes.FakeDistributedScheduler() fake_context = context.RequestContext('user', 'project') sched.zone_manager = ds_fakes.FakeZoneManager() self.stubs.Set(sched, '_filter_hosts', fake_filter_hosts) self.stubs.Set(least_cost, 'weighted_sum', _fake_weighted_sum) self.stubs.Set(engine.db, 'zone_get_all', fake_zone_get_all) self.stubs.Set(sched, '_call_zone_method', fake_call_zone_method) instance_type = dict(memory_mb=512, local_gb=512) request_spec = dict(num_instances=10, instance_type=instance_type, local_zone=True) weighted_hosts = sched._schedule(fake_context, 'compute', request_spec) self.assertEquals(len(weighted_hosts), 10) for weighted_host in weighted_hosts: # There should be no remote hosts self.assertTrue(weighted_host.host is not None) self.assertTrue(weighted_host.zone is None)
def setUp(self): super(XenAPIAutoDiskConfigTestCase, self).setUp() self.stubs = stubout.StubOutForTesting() self.flags(target_host='127.0.0.1', xenapi_connection_url='test_url', xenapi_connection_password='******') stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) xenapi_fake.reset() self.conn = xenapi_conn.get_connection(False) self.user_id = 'fake' self.project_id = 'fake' self.instance_values = {'id': 1, 'project_id': self.project_id, 'user_id': self.user_id, 'image_ref': 1, 'kernel_id': 2, 'ramdisk_id': 3, 'local_gb': 20, 'instance_type_id': '3', # m1.large 'os_type': 'linux', 'architecture': 'x86-64'} self.context = context.RequestContext(self.user_id, self.project_id) @classmethod def fake_create_vbd(cls, session, vm_ref, vdi_ref, userdevice, bootable=True): pass self.stubs.Set(volume_utils.VolumeHelper, "create_vbd", fake_create_vbd)
def setUp(self): super(FloatingIpPoolTest, self).setUp() self.stubs.Set(network.api.API, "get_floating_ip_pools", fake_get_floating_ip_pools) self.context = context.RequestContext('fake', 'fake') self.controller = floating_ip_pools.FloatingIPPoolsController()
def setUp(self): self.maxDiff = None super(ServerActionsControllerTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.stub_out_auth(self.stubs) self.stubs.Set(engine.db, 'instance_get', return_server_by_id) self.stubs.Set(engine.db, 'instance_get_by_uuid', return_server_by_uuid) self.stubs.Set(engine.db, 'instance_update', instance_update) fakes.stub_out_tank(self.stubs) fakes.stub_out_nw_api(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.snapshot = fakes.stub_out_compute_api_snapshot(self.stubs) service_class = 'engine.image.tank.TankImageService' self.service = utils.import_object(service_class) self.context = context.RequestContext(1, None) self.service.delete_all() self.sent_to_tank = {} fakes.stub_out_tank_add_image(self.stubs, self.sent_to_tank) self.flags(allow_instance_snapshots=True) self.uuid = FAKE_UUID self.url = '/v2/fake/servers/%s/action' % self.uuid self.controller = servers.Controller()
def setUp(self): super(XenAPIVMTestCase, self).setUp() self.network = utils.import_object(FLAGS.network_manager) self.stubs = stubout.StubOutForTesting() self.flags(xenapi_connection_url='test_url', xenapi_connection_password='******', instance_name_template='%d') xenapi_fake.reset() xenapi_fake.create_local_srs() xenapi_fake.create_local_pifs() db_fakes.stub_out_db_instance_api(self.stubs) xenapi_fake.create_network('fake', FLAGS.flat_network_bridge) stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) stubs.stubout_get_this_vm_uuid(self.stubs) stubs.stubout_stream_disk(self.stubs) stubs.stubout_is_vdi_pv(self.stubs) self.stubs.Set(vmops.VMOps, '_configure_instance', configure_instance) self.stubs.Set(vmops.VMOps, '_find_rescue_vbd_ref', _find_rescue_vbd_ref) stubs.stub_out_vm_methods(self.stubs) tank_stubs.stubout_tank_client(self.stubs) fake_utils.stub_out_utils_execute(self.stubs) self.user_id = 'fake' self.project_id = 'fake' self.context = context.RequestContext(self.user_id, self.project_id) self.conn = xenapi_conn.get_connection(False)
def setUp(self): super(PolicyFileTestCase, self).setUp() policy.reset() _, self.tmpfilename = tempfile.mkstemp() self.flags(policy_file=self.tmpfilename) self.context = context.RequestContext('fake', 'fake') self.target = {}
def __call__(self, req): if 'X-Auth-Token' not in req.headers: user_id = req.headers.get('X-Auth-User', 'admin') project_id = req.headers.get('X-Auth-Project-Id', 'admin') os_url = os.path.join(req.url, project_id) res = webob.Response() # NOTE(vish): This is expecting and returning Auth(1.1), whereas # keystone uses 2.0 auth. We should probably allow # 2.0 auth here as well. res.headers['X-Auth-Token'] = '%s:%s' % (user_id, project_id) res.headers['X-Server-Management-Url'] = os_url res.headers['X-Storage-Url'] = '' res.headers['X-CDN-Management-Url'] = '' res.content_type = 'text/plain' res.status = '204' return res token = req.headers['X-Auth-Token'] user_id, _sep, project_id = token.partition(':') project_id = project_id or user_id remote_address = getattr(req, 'remote_address', '127.0.0.1') if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) ctx = context.RequestContext(user_id, project_id, is_admin=True, remote_address=remote_address) req.environ['engine.context'] = ctx return self.application
def setUp(self): super(QuotaTestCase, self).setUp() self.flags(connection_type='fake', quota_instances=2, quota_cores=4, quota_volumes=2, quota_gigabytes=20, quota_floating_ips=1) self.network = self.network = self.start_service('network') self.user_id = 'admin' self.project_id = 'admin' self.context = context.RequestContext(self.user_id, self.project_id, is_admin=True) orig_rpc_call = rpc.call def rpc_call_wrapper(context, topic, msg): """Stub out the scheduler creating the instance entry""" if topic == FLAGS.scheduler_topic and \ msg['method'] == 'run_instance': scheduler = scheduler_driver.Scheduler instance = scheduler().create_instance_db_entry( context, msg['args']['request_spec']) return [scheduler_driver.encode_instance(instance)] else: return orig_rpc_call(context, topic, msg) self.stubs.Set(rpc, 'call', rpc_call_wrapper)
def __call__(self, req): """Generate a WSGI response based on the exception passed to ctor.""" code = self.wrapped_exc.status_int message = self.wrapped_exc.explanation if code == 501: message = "The requested function is not supported" code = str(code) if 'AWSAccessKeyId' not in req.params: raise webob.exc.HTTPBadRequest() user_id, _sep, project_id = req.params['AWSAccessKeyId'].partition(':') project_id = project_id or user_id remote_address = getattr(req, 'remote_address', '127.0.0.1') if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) ctxt = context.RequestContext(user_id, project_id, remote_address=remote_address) resp = webob.Response() resp.status = self.wrapped_exc.status_int resp.headers['Content-Type'] = 'text/xml' resp.body = str('<?xml version="1.0"?>\n' '<Response><Errors><Error><Code>%s</Code>' '<Message>%s</Message></Error></Errors>' '<RequestID>%s</RequestID></Response>' % (utils.utf8(code), utils.utf8(message), utils.utf8(ctxt.request_id))) return resp
def setUp(self): super(AdminApiTestCase, self).setUp() self.flags(connection_type='fake') # set up our cloud self.api = admin.AdminController() # set up services self.compute = self.start_service('compute') self.scheduter = self.start_service('scheduler') self.network = self.start_service('network') self.volume = self.start_service('volume') self.image_service = utils.import_object(FLAGS.image_service) self.user_id = 'admin' self.project_id = 'admin' self.context = context.RequestContext(self.user_id, self.project_id, is_admin=True) def fake_show(meh, context, id): return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1, 'type': 'machine', 'image_state': 'available'}} self.stubs.Set(fake._FakeImageService, 'show', fake_show) self.stubs.Set(fake._FakeImageService, 'show_by_name', fake_show) # NOTE(comstud): Make 'cast' behave like a 'call' which will # ensure that operations complete self.stubs.Set(rpc, 'cast', rpc.call)
def setUp(self): super(TestTankImageService, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.stub_out_compute_api_snapshot(self.stubs) client = tank_stubs.StubTankClient() self.service = tank.TankImageService(client=client) self.context = context.RequestContext('fake', 'fake', auth_token=True) self.service.delete_all()
def setUp(self): super(DirectTestCase, self).setUp() direct.register_service('fake', FakeService()) self.router = direct.PostParamsMiddleware( direct.JsonParamsMiddleware( direct.Router())) self.auth_router = direct.DelegatedAuthMiddleware(self.router) self.context = context.RequestContext('user1', 'proj1')
def _delete_nets(self): for n in networks: ctx = context.RequestContext('user1', n['project_id']) db_nets = db.network_get_all(ctx.elevated()) for x in db_nets: if x['label'] == n['label']: n['uuid'] = x['uuid'] self.net_man.delete_network(ctx, None, n['uuid'])
def setUp(self): super(ConsoleTestCase, self).setUp() self.flags(console_driver='engine.console.fake.FakeConsoleProxy', stub_compute=True) self.console = utils.import_object(FLAGS.console_manager) self.user_id = 'fake' self.project_id = 'fake' self.context = context.RequestContext(self.user_id, self.project_id) self.host = 'test_compute_host'
def setUp(self): super(ApiEc2TestCase, self).setUp() self.host = '127.0.0.1' # NOTE(vish): skipping the Authorizer roles = ['sysadmin', 'netadmin'] ctxt = context.RequestContext('fake', 'fake', roles=roles) self.app = auth.InjectContext(ctxt, ec2.Requestify(ec2.Authorizer(ec2.Executor()), 'engine.api.ec2.cloud.CloudController'))
def setUp(self): super(TestS3ImageService, self).setUp() self.flags(image_service='engine.image.fake.FakeImageService') self.image_service = s3.S3ImageService() self.context = context.RequestContext(None, None) # set up one fixture to test shows, should have id '1' engine.db.api.s3_image_create(self.context, '155d900f-4e14-4e4c-a73d-069cbf4541e6')
def __call__(self, req): if not self.has_authentication(req): return self.authenticate(req) user_id = self.get_user_by_authentication(req) if not user_id: token = req.headers["X-Auth-Token"] msg = _("%(user_id)s could not be found with token '%(token)s'") LOG.warn(msg % locals()) return wsgi.Fault(webob.exc.HTTPUnauthorized()) # Get all valid projects for the user projects = self.auth.get_projects(user_id) if not projects: return wsgi.Fault(webob.exc.HTTPUnauthorized()) project_id = "" path_parts = req.path.split('/') # TODO(wwolf): this v1.1 check will be temporary as # keystone should be taking this over at some point if len(path_parts) > 1 and path_parts[1] in ('v1.1', 'v2'): project_id = path_parts[2] # Check that the project for project_id exists, and that user # is authorized to use it try: self.auth.get_project(project_id) except exception.ProjectNotFound: return wsgi.Fault(webob.exc.HTTPUnauthorized()) if project_id not in [p.id for p in projects]: return wsgi.Fault(webob.exc.HTTPUnauthorized()) else: # As a fallback, set project_id from the headers, which is the v1.0 # behavior. As a last resort, be forgiving to the user and set # project_id based on a valid project of theirs. try: project_id = req.headers["X-Auth-Project-Id"] except KeyError: project_id = projects[0].id is_admin = self.auth.is_admin(user_id) remote_address = getattr(req, 'remote_address', '127.0.0.1') if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) ctx = context.RequestContext(user_id, project_id, is_admin=is_admin, remote_address=remote_address) req.environ['engine.context'] = ctx if not is_admin and not self.auth.is_project_member( user_id, project_id): msg = _("%(user_id)s must be an admin or a " "member of %(project_id)s") LOG.warn(msg % locals()) return wsgi.Fault(webob.exc.HTTPUnauthorized()) return self.application
def response_status(self, user, methodName): roles = manager.AuthManager().get_active_roles(user, self.project) ctxt = context.RequestContext(user.id, self.project.id, is_admin=user.is_admin(), roles=roles) environ = self._env_for(ctxt, methodName) req = webob.Request.blank('/', environ) resp = req.get_response(self.mw) return resp.status_int
def __call__(self, req): # find or create user try: user_id = req.headers['X_USER'] except: return webob.exc.HTTPUnauthorized() try: user_ref = self.auth.get_user(user_id) except: user_ref = self.auth.create_user(user_id) # get the roles roles = [r.strip() for r in req.headers.get('X_ROLE', '').split(',')] # set user admin-ness to keystone admin-ness # FIXME: keystone-admin-role value from keystone.conf is not # used neither here nor in tank_auth_token! roles = [r.strip() for r in req.headers.get('X_ROLE', '').split(',')] is_admin = 'Admin' in roles if user_ref.is_admin() != is_admin: self.auth.modify_user(user_ref, admin=is_admin) # create a project for tenant if 'X_TENANT_ID' in req.headers: # This is the new header since Keystone went to ID/Name project_id = req.headers['X_TENANT_ID'] else: # This is for legacy compatibility project_id = req.headers['X_TENANT'] if project_id: try: project_ref = self.auth.get_project(project_id) except: project_ref = self.auth.create_project(project_id, user_id) # ensure user is a member of project if not self.auth.is_project_member(user_id, project_id): self.auth.add_to_project(user_id, project_id) else: project_ref = None # Get the auth token auth_token = req.headers.get('X_AUTH_TOKEN', req.headers.get('X_STORAGE_TOKEN')) # Build a context, including the auth_token... ctx = context.RequestContext(user_id, project_id, is_admin=('Admin' in roles), auth_token=auth_token) req.environ['engine.context'] = ctx return self.application
def test_allocate_and_deallocate_instance_static(self): self._create_nets() project_id = "fake_project1" ctx = context.RequestContext('user1', project_id) instance_ref = db.instance_create(ctx, {"project_id": project_id}) def func(arg1, arg2): pass def func2(arg1, arg2, arg3): pass def func1(arg1): pass self.net_man.driver.update_dhcp_hostfile_with_text = func self.net_man.driver.restart_dhcp = func2 self.net_man.driver.kill_dhcp = func1 nw_info = self.net_man.allocate_for_instance(ctx, instance_id=instance_ref['id'], host="", instance_type_id=instance_ref['instance_type_id'], project_id=project_id) self.assertEquals(len(nw_info), 2) # we don't know which order the NICs will be in until we # introduce the notion of priority # v4 cidr self.assertTrue(nw_info[0][0]['cidr'].startswith("10.")) self.assertTrue(nw_info[1][0]['cidr'].startswith("192.")) # v4 address self.assertTrue(nw_info[0][1]['ips'][0]['ip'].startswith("10.")) self.assertTrue(nw_info[1][1]['ips'][0]['ip'].startswith("192.")) # v6 cidr self.assertTrue(nw_info[0][0]['cidr_v6'].startswith("2001:1dba:")) self.assertTrue(nw_info[1][0]['cidr_v6'].startswith("2001:1db8:")) # v6 address self.assertTrue( nw_info[0][1]['ip6s'][0]['ip'].startswith("2001:1dba:")) self.assertTrue( nw_info[1][1]['ip6s'][0]['ip'].startswith("2001:1db8:")) self.net_man.deallocate_for_instance(ctx, instance_id=instance_ref['id'], project_id=project_id) self._delete_nets()
def test_run_instance_with_blob_hint(self): """ Check the local/child zone routing in the run_instance() call. If the zone_blob hint was passed in, don't re-schedule. """ self.schedule_called = False self.from_blob_called = False self.locally_called = False self.child_zone_called = False def _fake_schedule(*args, **kwargs): self.schedule_called = True return least_cost.WeightedHost(1, host='x') def _fake_make_weighted_host_from_blob(*args, **kwargs): self.from_blob_called = True return least_cost.WeightedHost(1, zone='x', blob='y') def _fake_provision_resource_locally(*args, **kwargs): self.locally_called = True return 1 def _fake_ask_child_zone_to_create_instance(*args, **kwargs): self.child_zone_called = True return 2 sched = ds_fakes.FakeDistributedScheduler() self.stubs.Set(sched, '_schedule', _fake_schedule) self.stubs.Set(sched, '_make_weighted_host_from_blob', _fake_make_weighted_host_from_blob) self.stubs.Set(sched, '_provision_resource_locally', _fake_provision_resource_locally) self.stubs.Set(sched, '_ask_child_zone_to_create_instance', _fake_ask_child_zone_to_create_instance) request_spec = { 'instance_properties': {}, 'instance_type': {}, 'filter_driver': 'engine.scheduler.host_filter.AllHostsFilter', 'blob': "Non-None blob data", } fake_context = context.RequestContext('user', 'project') instances = sched.schedule_run_instance(fake_context, request_spec) self.assertTrue(instances) self.assertFalse(self.schedule_called) self.assertTrue(self.from_blob_called) self.assertTrue(self.child_zone_called) self.assertFalse(self.locally_called) self.assertEquals(instances, [2])
def __call__(self, req): if 'AWSAccessKeyId' not in req.params: raise webob.exc.HTTPBadRequest() user_id, _sep, project_id = req.params['AWSAccessKeyId'].partition(':') project_id = project_id or user_id remote_address = getattr(req, 'remote_address', '127.0.0.1') if FLAGS.use_forwarded_for: remote_address = req.headers.get('X-Forwarded-For', remote_address) ctx = context.RequestContext(user_id, project_id, is_admin=True, remote_address=remote_address) req.environ['engine.context'] = ctx return self.application
def setUp(self): super(PolicyTestCase, self).setUp() policy.reset() # NOTE(vish): preload rules to circumvent reloading from file policy.init() rules = { "true": [], "example:allowed": [], "example:denied": [["false:false"]], "example:get_http": [["http:http://www.example.com"]], "example:my_file": [["role:compute_admin"], ["project_id:%(project_id)s"]], "example:early_and_fail": [["false:false", "rule:true"]], "example:early_or_success": [["rule:true"], ["false:false"]], "example:sysadmin_allowed": [["role:admin"], ["role:sysadmin"]], } # NOTE(vish): then overload underlying brain common_policy.set_brain(common_policy.HttpBrain(rules)) self.context = context.RequestContext('fake', 'fake', roles=['member']) self.admin_context = context.RequestContext('admin', 'fake', roles=['admin'], is_admin=True) self.target = {}
def _create_network(self, n): ctx = context.RequestContext('user1', n['project_id']) nwks = self.net_man.create_networks( ctx, label=n['label'], cidr=n['cidr'], multi_host=n['multi_host'], num_networks=1, network_size=256, cidr_v6=n['cidr_v6'], gateway=n['gateway'], gateway_v6=n['gateway_v6'], bridge=None, bridge_interface=None, dns1=n['dns1'], dns2=n['dns2'], project_id=n['project_id'], priority=n['priority']) n['uuid'] = nwks[0]['uuid']
def launch_vpn_instance(self, project_id, user_id): LOG.debug(_("Launching VPN for %s") % (project_id)) ctxt = context.RequestContext(user_id=user_id, project_id=project_id) key_name = self.setup_key_pair(ctxt) group_name = self.setup_security_group(ctxt) ec2_id = ec2utils.image_ec2_id(FLAGS.vpn_image_id) reservation = self.controller.run_instances(ctxt, user_data=self.get_encoded_zip(project_id), max_count=1, min_count=1, instance_type='m1.tiny', image_id=ec2_id, key_name=key_name, security_group=[group_name])
def setUp(self): super(UsageInfoTestCase, self).setUp() self.flags(connection_type='fake', stub_network=True, notification_driver='engine.notifier.test_notifier', network_manager='engine.network.manager.FlatManager') self.compute = utils.import_object(FLAGS.compute_manager) self.user_id = 'fake' self.project_id = 'fake' self.context = context.RequestContext(self.user_id, self.project_id) test_notifier.NOTIFICATIONS = [] def fake_show(meh, context, id): return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}} self.stubs.Set(engine.image.fake._FakeImageService, 'show', fake_show)