def setUp(self): super(CloudpipeTest, self).setUp() self.app = fakes.wsgi_app() inner_app = compute.APIRouter() self.context = context.RequestContext('fake', 'fake', is_admin=True) self.app = auth.InjectContext(self.context, inner_app) route = inner_app.map.match('/1234/os-cloudpipe') self.controller = route['controller'].controller fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(db, "instance_get_all_by_project", db_instance_get_all_by_project) self.stubs.Set(db, "security_group_exists", db_security_group_exists) self.stubs.SmartSet(self.controller.cloudpipe, "launch_vpn_instance", pipelib_launch_vpn_instance) #self.stubs.SmartSet(self.controller.auth_manager, "get_project", # auth_manager_get_project) #self.stubs.SmartSet(self.controller.auth_manager, "get_projects", # auth_manager_get_projects) # NOTE(todd): The above code (just setting the stub, not invoking it) # causes failures in AuthManagerLdapTestCase. So use a fake object. self.controller.auth_manager = FakeAuthManager() self.stubs.Set(utils, 'vpn_ping', utils_vpn_ping) global EMPTY_INSTANCE_LIST EMPTY_INSTANCE_LIST = True
def setUp(self): super(ConfigDriveTestV21, self).setUp() self.Controller = self._get_config_drive_controller() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fake.stub_out_image_service(self.stubs) self._setup_wsgi()
def setUp(self): super(ConfigDriveTest, self).setUp() ext_info = plugins.LoadedExtensionInfo() self.Controller = config_drive.ConfigDriveController(extension_info=ext_info) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fake.stub_out_image_service(self.stubs)
def setUp(self): super(ServersTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fakes.stub_out_image_service(self.stubs) self.stubs.Set(nova.db.api, 'instance_get_all', return_servers) self.stubs.Set(nova.db.api, 'instance_get', return_server) self.stubs.Set(nova.db.api, 'instance_get_all_by_user', return_servers) self.stubs.Set(nova.db.api, 'instance_add_security_group', return_security_group) self.stubs.Set(nova.db.api, 'instance_update', instance_update) self.stubs.Set(nova.db.api, 'instance_get_fixed_address', instance_address) self.stubs.Set(nova.db.api, 'instance_get_floating_address', instance_address) self.stubs.Set(nova.compute.API, 'pause', fake_compute_api) self.stubs.Set(nova.compute.API, 'unpause', fake_compute_api) self.stubs.Set(nova.compute.API, 'suspend', fake_compute_api) self.stubs.Set(nova.compute.API, 'resume', fake_compute_api) self.stubs.Set(nova.compute.API, "get_diagnostics", fake_compute_api) self.stubs.Set(nova.compute.API, "get_actions", fake_compute_api) self.allow_admin = FLAGS.allow_admin_api self.webreq = common.webob_factory('/v1.0/servers')
def setUp(self): self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.auth_data = {} fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs)
def setUp(self): super(NetworksTest, self).setUp() self.fake_network_api = FakeNetworkAPI() self.controller = networks.NetworkController(self.fake_network_api) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.context = context.RequestContext('user', '1234', is_admin=True)
def setUp(self): super(NetworksTest, self).setUp() self.fake_network_api = FakeNetworkAPI() self.controller = networks.NetworkController(self.fake_network_api) self.associate_controller = networks_associate.NetworkAssociateActionController(self.fake_network_api) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs)
def setUp(self): super(TestNoAuthMiddleware, self).setUp() self.stubs.Set(context, 'RequestContext', fakes.FakeRequestContext) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthDatabase.data = {} fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_networking(self.stubs)
def setUp(self): self.stubs = stubout.StubOutForTesting() self.stubs.Set(nova.api.openstack.auth.AuthMiddleware, '__init__', fakes.fake_auth_init) self.stubs.Set(context, 'RequestContext', fakes.FakeRequestContext) fakes.FakeAuthManager.auth_data = {} fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs)
def setUp(self): super(VolumesSampleJsonTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(cinder.API, "delete", self._stub_volume_delete) self.stubs.Set(cinder.API, "get", self._stub_volume_get) self.stubs.Set(cinder.API, "get_all", self._stub_volume_get_all)
def setUp(self): super(FlavorsTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.db.api, "instance_type_get_all", return_instance_types) self.stubs.Set(nova.db.api, "instance_type_get_by_flavor_id", return_instance_type_by_flavor_id)
def setUp(self): super(TestLimiter, self).setUp() self.stubs.Set(auth.AuthMiddleware, '__init__', fakes.fake_auth_init) self.stubs.Set(context, 'RequestContext', fakes.FakeRequestContext) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs)
def setUp(self): super(KeypairsTest, self).setUp() self.controller = KeypairController() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(db, "key_pair_get_all_by_user", db_key_pair_get_all_by_user) self.stubs.Set(db, "key_pair_create", db_key_pair_create) self.stubs.Set(db, "key_pair_destroy", db_key_pair_destroy) self.context = context.get_admin_context()
def setUp(self): super(FixedIpTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(compute.api.API, "add_fixed_ip", compute_api_add_fixed_ip) self.stubs.Set(compute.api.API, "remove_fixed_ip", compute_api_remove_fixed_ip) self.stubs.Set(compute.api.API, 'get', compute_api_get)
def setUp(self): super(FlavorsTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.auth_data = {} fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.context = context.get_admin_context()
def setUp(self): super(Test, self).setUp() self.stubs.Set(nova.api.openstack.v2.auth.AuthMiddleware, '__init__', fakes.fake_auth_init) self.stubs.Set(context, 'RequestContext', fakes.FakeRequestContext) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthDatabase.data = {} fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_networking(self.stubs)
def setUp(self): super(AdminAPITest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.auth_data = {} fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.allow_admin = FLAGS.allow_admin_api
def setUp(self): super(FlavorsTest, self).setUp() self.flags(osapi_compute_extension=[]) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.compute.flavors, "get_all_flavors_sorted_list", fake_get_all_flavors_sorted_list) self.stubs.Set(nova.compute.flavors, "get_flavor_by_flavor_id", fake_flavor_get_by_flavor_id) self.controller = flavors.Controller()
def setUp(self): super(NetworksTest, self).setUp() self.fake_network_api = FakeNetworkAPI() ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-networks': 'fake'} self.controller = networks.NetworkController( self.fake_network_api, ext_mgr) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs)
def setUp(self): super(ConfigDriveTest, self).setUp() self.Controller = config_drive.Controller() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) nova.tests.image.fake.stub_out_image_service(self.stubs) self.flags( osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions'], osapi_compute_ext_list=['Config_drive'])
def setUp(self): super(ConfigDriveTest, self).setUp() self.Controller = config_drive.Controller() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) nova.tests.image.fake.stub_out_image_service(self.stubs) self.flags(osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions' ], osapi_compute_ext_list=['Config_drive'])
def setUp(self): super(FixedIpTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(compute.api.API, "add_fixed_ip", compute_api_add_fixed_ip) self.stubs.Set(compute.api.API, "remove_fixed_ip", compute_api_remove_fixed_ip) self.stubs.Set(compute.api.API, 'get', compute_api_get) self.app = fakes.wsgi_app_v3(init_only=('servers', 'os-multinic'))
def setUp(self): super(FixedIpTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(compute.api.API, "add_fixed_ip", compute_api_add_fixed_ip) self.stubs.Set(compute.api.API, "remove_fixed_ip", compute_api_remove_fixed_ip) self.stubs.Set(compute.api.API, 'get', compute_api_get) self.context = context.get_admin_context()
def setUp(self): super(ZonesTest, self).setUp() self.flags(allow_admin_api=True) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.db, 'zone_get', zone_get) self.stubs.Set(nova.db, 'zone_update', zone_update) self.stubs.Set(nova.db, 'zone_create', zone_create) self.stubs.Set(nova.db, 'zone_delete', zone_delete)
def setUp(self): super(KeypairsTest, self).setUp() self.Controller = keypairs.Controller() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(db, "key_pair_get_all_by_user", db_key_pair_get_all_by_user) self.stubs.Set(db, "key_pair_create", db_key_pair_create) self.stubs.Set(db, "key_pair_destroy", db_key_pair_destroy)
def setUp(self): super(KeypairsTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(db, "key_pair_get_all_by_user", db_key_pair_get_all_by_user) self.stubs.Set(db, "key_pair_create", db_key_pair_create) self.stubs.Set(db, "key_pair_destroy", db_key_pair_destroy)
def setUp(self): super(FlavorsTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(nova.db.api, "instance_type_get_all", return_instance_types) self.stubs.Set(nova.db.api, "instance_type_get_by_flavor_id", return_instance_type_by_flavor_id)
def setUp(self): super(VSAApiTest, self).setUp() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(vsa_api.API, "create", stub_vsa_create) self.stubs.Set(vsa_api.API, "delete", stub_vsa_delete) self.stubs.Set(vsa_api.API, "get", stub_vsa_get) self.stubs.Set(vsa_api.API, "get_all", stub_vsa_get_all)
def setUp(self): super(ZonesTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.db, 'zone_get', zone_get) self.stubs.Set(nova.db, 'zone_update', zone_update) self.stubs.Set(nova.db, 'zone_create', zone_create) self.stubs.Set(nova.db, 'zone_delete', zone_delete) self.controller = zones.Controller()
def setUp(self): """Run before each test.""" super(ImagesControllerTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fakes.stub_out_compute_api_snapshot(self.stubs) fakes.stub_out_compute_api_backup(self.stubs) fakes.stub_out_glance(self.stubs) self.controller = images.Controller()
def setUp(self): super(FlavorsTest, self).setUp() self.flags(osapi_compute_extension=[]) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.compute.flavors, "get_all_flavors_sorted_list", fake_get_all_flavors_sorted_list) self.stubs.Set(nova.compute.flavors, "get_flavor_by_flavor_id", fake_flavor_get_by_flavor_id) self.controller = flavors.FlavorsController()
def setUp(self): self.orig_image_service = FLAGS.image_service FLAGS.image_service = 'nova.image.glance.GlanceImageService' self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.auth_data = {} fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fakes.stub_out_glance(self.stubs, initial_fixtures=self.IMAGE_FIXTURES)
def setUp(self): super(NetworksTest, self).setUp() self.fake_network_api = FakeNetworkAPI() ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-networks': 'fake'} self.controller = networks.NetworkController(self.fake_network_api, ext_mgr) self.associate_controller = networks_associate\ .NetworkAssociateActionController(self.fake_network_api) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs)
def setUp(self): super(FlavorsTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.compute.instance_types, "get_all_types", fake_instance_type_get_all) self.stubs.Set(nova.compute.instance_types, "get_instance_type_by_flavor_id", fake_instance_type_get_by_flavor_id) self.controller = flavors.Controller()
def setUp(self): super(VolumeApiTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.db, 'volume_get', return_volume) self.stubs.Set(volume.api.API, "delete", fakes.stub_volume_delete) self.stubs.Set(volume.api.API, "get", fakes.stub_volume_get) self.stubs.Set(volume.api.API, "get_all", fakes.stub_volume_get_all) self.context = context.get_admin_context()
def setUp(self): super(ZonesTest, self).setUp() self.flags(verbose=True, allow_admin_api=True) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(nova.db, 'zone_get', zone_get) self.stubs.Set(nova.db, 'zone_update', zone_update) self.stubs.Set(nova.db, 'zone_create', zone_create) self.stubs.Set(nova.db, 'zone_delete', zone_delete) self.controller = zones.Controller()
def setUp(self): super(ImageControllerWithGlanceServiceTest, self).setUp() self.orig_image_service = FLAGS.image_service FLAGS.image_service = 'nova.image.glance.GlanceImageService' self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fakes.stub_out_glance(self.stubs, initial_fixtures=self.IMAGE_FIXTURES)
def setUp(self): super(FlavorsTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(nova.db.api, "instance_type_get_all", return_instance_types) self.stubs.Set(nova.db.api, "instance_type_get_by_flavor_id", return_instance_type_by_flavor_id) self.context = context.get_admin_context()
def setUp(self): super(VSAApiTest, self).setUp() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(vsa.api.API, "create", stub_vsa_create) self.stubs.Set(vsa.api.API, "delete", stub_vsa_delete) self.stubs.Set(vsa.api.API, "get", stub_vsa_get) self.stubs.Set(vsa.api.API, "get_all", stub_vsa_get_all) self.context = context.get_admin_context()
def setUp(self): super(FixedIpTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(compute.api.API, "add_fixed_ip", compute_api_add_fixed_ip) self.stubs.Set(compute.api.API, "remove_fixed_ip", compute_api_remove_fixed_ip) self.stubs.Set(compute.api.API, 'get', compute_api_get) self.flags(osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions' ], osapi_compute_ext_list=['Multinic']) self.app = fakes.wsgi_app(init_only=('servers', ))
def setUp(self): super(KeypairsTestV21, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(db, "key_pair_get_all_by_user", db_key_pair_get_all_by_user) self.stubs.Set(db, "key_pair_create", db_key_pair_create) self.stubs.Set(db, "key_pair_destroy", db_key_pair_destroy) self.flags(osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions' ], osapi_compute_ext_list=['Keypairs']) self._setup_app()
def setUp(self): super(SnapshotApiTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(volume.api.API, "create_snapshot", stub_snapshot_create) self.stubs.Set(volume.api.API, "create_snapshot_force", stub_snapshot_create) self.stubs.Set(volume.api.API, "delete_snapshot", stub_snapshot_delete) self.stubs.Set(volume.api.API, "get_snapshot", stub_snapshot_get) self.stubs.Set(volume.api.API, "get_all_snapshots", stub_snapshot_get_all) self.stubs.Set(volume.api.API, "get", fakes.stub_volume_get) self.context = context.get_admin_context()
def setUp(self): super(VolumeApiTest, self).setUp() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(nova.db, 'volume_get', return_volume) self.stubs.Set(volume.api.API, "delete", fakes.stub_volume_delete) self.stubs.Set(volume.api.API, "get", fakes.stub_volume_get) self.stubs.Set(volume.api.API, "get_all", fakes.stub_volume_get_all) self.context = context.get_admin_context()
def setUp(self): super(KeypairsTest, self).setUp() self.Controller = keypairs.Controller() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(db, "key_pair_get_all_by_user", db_key_pair_get_all_by_user) self.stubs.Set(db, "key_pair_create", db_key_pair_create) self.stubs.Set(db, "key_pair_destroy", db_key_pair_destroy) self.flags(osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions' ], osapi_compute_ext_list=['Keypairs']) self.app = fakes.wsgi_app(init_only=('os-keypairs', ))
def setUp(self): super(NetworkCreateExceptionsTest, self).setUp() ext_mgr = extensions.ExtensionManager() ext_mgr.extensions = {'os-extended-networks': 'fake'} class PassthroughAPI(): def __init__(self): self.network_manager = manager.FlatDHCPManager() def create(self, *args, **kwargs): return self.network_manager.create_networks(*args, **kwargs) self.controller = networks.NetworkController(PassthroughAPI(), ext_mgr) fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs)
def setUp(self): super(VolumeApiTest, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(cinder.API, "delete", fakes.stub_volume_delete) self.stubs.Set(cinder.API, "get", fakes.stub_volume_get) self.stubs.Set(cinder.API, "get_all", fakes.stub_volume_get_all) self.flags(osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions' ], osapi_compute_ext_list=['Volumes']) self.context = context.get_admin_context() self.app = fakes.wsgi_app(init_only=('os-volumes', ))
def setUp(self): super(AccountsTest, self).setUp() self.flags(verbose=True) self.stubs.Set(accounts.Controller, '__init__', fake_init) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakemgr = fakes.FakeAuthManager() joeuser = auth_manager.User('id1', 'guy1', 'acc1', 'secret1', False) superuser = auth_manager.User('id2', 'guy2', 'acc2', 'secret2', True) fakemgr.add_user(joeuser) fakemgr.add_user(superuser) fakemgr.create_project('test1', joeuser) fakemgr.create_project('test2', superuser)
def setUp(self): super(ZonesTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.allow_admin = FLAGS.allow_admin_api FLAGS.allow_admin_api = True self.stubs.Set(nova.db, 'zone_get', zone_get) self.stubs.Set(nova.db, 'zone_update', zone_update) self.stubs.Set(nova.db, 'zone_create', zone_create) self.stubs.Set(nova.db, 'zone_delete', zone_delete)
def setUp(self): super(SnapshotApiTest, self).setUp() self.stubs = stubout.StubOutForTesting() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(volume.api.API, "create_snapshot", stub_snapshot_create) self.stubs.Set(volume.api.API, "create_snapshot_force", stub_snapshot_create) self.stubs.Set(volume.api.API, "delete_snapshot", stub_snapshot_delete) self.stubs.Set(volume.api.API, "get_snapshot", stub_snapshot_get) self.stubs.Set(volume.api.API, "get_all_snapshots", stub_snapshot_get_all) self.context = context.get_admin_context()
def setUp(self): super(UsersTest, self).setUp() self.flags(verbose=True) self.stubs.Set(users.Controller, '__init__', fake_init) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthManager.projects = dict( testacct=Project('testacct', 'testacct', 'id1', 'test', [])) fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) fakemgr = fakes.FakeAuthManager() fakemgr.add_user(User('id1', 'guy1', 'acc1', 'secret1', False)) fakemgr.add_user(User('id2', 'guy2', 'acc2', 'secret2', True)) self.controller = users.Controller()
def setUp(self): super(UsersTest, self).setUp() self.stubs = stubout.StubOutForTesting() self.stubs.Set(users.Controller, '__init__', fake_init) self.stubs.Set(users.Controller, '_check_admin', fake_admin_check) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthManager.projects = dict( testacct=Project('testacct', 'testacct', 'id1', 'test', [])) fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.allow_admin = FLAGS.allow_admin_api FLAGS.allow_admin_api = True fakemgr = fakes.FakeAuthManager() fakemgr.add_user(User('id1', 'guy1', 'acc1', 'secret1', False)) fakemgr.add_user(User('id2', 'guy2', 'acc2', 'secret2', True))
def setUp(self, test_obj=None, test_objs=None): super(VSAVolumeApiTest, self).setUp() fakes.FakeAuthManager.reset_fake_data() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.stubs.Set(nova.db, 'vsa_get', return_vsa) self.stubs.Set(vsa.api.API, "get_vsa_volume_type", stub_get_vsa_volume_type) self.stubs.Set(volume.api.API, "update", fakes.stub_volume_update) self.stubs.Set(volume.api.API, "delete", fakes.stub_volume_delete) self.stubs.Set(volume.api.API, "get", fakes.stub_volume_get) self.stubs.Set(volume.api.API, "get_all", fakes.stub_volume_get_all) self.context = context.get_admin_context() self.test_obj = test_obj if test_obj else "volume" self.test_objs = test_objs if test_objs else "volumes"
def setUp(self): super(FloatingIpTest, self).setUp() self.controller = FloatingIPController() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) self.stubs.Set(network.api.API, "get_floating_ip", network_api_get_floating_ip) self.stubs.Set(network.api.API, "list_floating_ips", network_api_list_floating_ips) self.stubs.Set(network.api.API, "allocate_floating_ip", network_api_allocate) self.stubs.Set(network.api.API, "release_floating_ip", network_api_release) self.stubs.Set(network.api.API, "associate_floating_ip", network_api_associate) self.stubs.Set(network.api.API, "disassociate_floating_ip", network_api_disassociate) self.context = context.get_admin_context() self._create_floating_ip()
def setUp(self): super(AccountsTest, self).setUp() self.stubs = stubout.StubOutForTesting() self.stubs.Set(accounts.Controller, '__init__', fake_init) self.stubs.Set(accounts.Controller, '_check_admin', fake_admin_check) fakes.FakeAuthManager.clear_fakes() fakes.FakeAuthDatabase.data = {} fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_auth(self.stubs) self.allow_admin = FLAGS.allow_admin_api FLAGS.allow_admin_api = True fakemgr = fakes.FakeAuthManager() joeuser = User('id1', 'guy1', 'acc1', 'secret1', False) superuser = User('id2', 'guy2', 'acc2', 'secret2', True) fakemgr.add_user(joeuser) fakemgr.add_user(superuser) fakemgr.create_project('test1', joeuser) fakemgr.create_project('test2', superuser)
def setUp(self): """Run before each test.""" super(ImagesControllerTestV21, self).setUp() fakes.stub_out_networking(self.stubs) fakes.stub_out_rate_limiting(self.stubs) fakes.stub_out_key_pair_funcs(self.stubs) fakes.stub_out_compute_api_snapshot(self.stubs) fakes.stub_out_compute_api_backup(self.stubs) self.controller = self.image_controller_class() self.url_prefix = "http://localhost%s/images" % self.url_base self.bookmark_prefix = "http://localhost%s/images" % self.bookmark_base self.uuid = 'fa95aaf5-ab3b-4cd8-88c0-2be7dd051aaf' self.server_uuid = "aa640691-d1a7-4a67-9d3c-d35ee6b3cc74" self.server_href = ( "http://localhost%s/servers/%s" % (self.url_base, self.server_uuid)) self.server_bookmark = ( "http://localhost%s/servers/%s" % (self.bookmark_base, self.server_uuid)) self.alternate = "%s/images/%s" self.expected_image_123 = { "image": {'id': '123', 'name': 'public image', 'metadata': {'key1': 'value1'}, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, 'status': 'ACTIVE', 'minDisk': 10, 'progress': 100, 'minRam': 128, "links": [{ "rel": "self", "href": "%s/123" % self.url_prefix }, { "rel": "bookmark", "href": "%s/123" % self.bookmark_prefix }, { "rel": "alternate", "type": "application/vnd.openstack.image", "href": self.alternate % (glance.generate_glance_url(), 123), }], }, } self.expected_image_124 = { "image": {'id': '124', 'name': 'queued snapshot', 'metadata': { u'instance_uuid': self.server_uuid, u'user_id': u'fake', }, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, 'status': 'SAVING', 'progress': 25, 'minDisk': 0, 'minRam': 0, 'server': { 'id': self.server_uuid, "links": [{ "rel": "self", "href": self.server_href, }, { "rel": "bookmark", "href": self.server_bookmark, }], }, "links": [{ "rel": "self", "href": "%s/124" % self.url_prefix }, { "rel": "bookmark", "href": "%s/124" % self.bookmark_prefix }, { "rel": "alternate", "type": "application/vnd.openstack.image", "href": self.alternate % (glance.generate_glance_url(), 124), }], }, }