Ejemplo n.º 1
0
    def setUp(self):
        self.maxDiff = None
        super(ServerActionsControllerTest, self).setUp()

        self.stubs = stubout.StubOutForTesting()
        fakes.stub_out_auth(self.stubs)
        self.stubs.Set(nova.db, 'instance_get_by_uuid',
                fakes.fake_instance_get(vm_state=vm_states.ACTIVE,
                        host='fake_host'))
        self.stubs.Set(nova.db, 'instance_update', instance_update)

        fakes.stub_out_glance(self.stubs)
        fakes.stub_out_nw_api(self.stubs)
        fakes.stub_out_rate_limiting(self.stubs)
        fakes.stub_out_compute_api_snapshot(self.stubs)
        fakes.stub_out_image_service(self.stubs)
        service_class = 'nova.image.glance.GlanceImageService'
        self.service = utils.import_object(service_class)
        self.context = context.RequestContext(1, None)
        self.service.delete_all()
        self.sent_to_glance = {}
        fakes.stub_out_glance_add_image(self.stubs, self.sent_to_glance)
        self.flags(allow_instance_snapshots=True,
                   enable_instance_password=True)
        self.uuid = FAKE_UUID
        self.url = '/v2/fake/servers/%s/action' % self.uuid
        self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6'

        self.controller = servers.Controller()
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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()
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
    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):
     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)
Ejemplo n.º 9
0
 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
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
    def setUp(self):
        super(ServerActionsControllerTest, self).setUp()

        self.stubs.Set(
            db, 'instance_get_by_uuid',
            fakes.fake_instance_get(vm_state=vm_states.ACTIVE,
                                    host='fake_host'))
        self.stubs.Set(db, 'instance_update_and_get_original', instance_update)

        fakes.stub_out_glance(self.stubs)
        fakes.stub_out_nw_api(self.stubs)
        fakes.stub_out_rate_limiting(self.stubs)
        fakes.stub_out_compute_api_snapshot(self.stubs)
        fake.stub_out_image_service(self.stubs)
        service_class = 'nova.image.glance.GlanceImageService'
        self.service = importutils.import_object(service_class)
        self.sent_to_glance = {}
        fakes.stub_out_glanceclient_create(self.stubs, self.sent_to_glance)
        self.flags(allow_instance_snapshots=True,
                   enable_instance_password=True)
        self.uuid = FAKE_UUID
        self.url = '/v2/fake/servers/%s/action' % self.uuid
        self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6'

        self.controller = servers.Controller()
Ejemplo n.º 12
0
    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')
Ejemplo n.º 13
0
    def setUp(self):
        self.maxDiff = None
        super(ServerActionsControllerTest, self).setUp()

        self.stubs = stubout.StubOutForTesting()
        fakes.stub_out_auth(self.stubs)
        self.stubs.Set(nova.db, 'instance_get', return_server_by_id)
        self.stubs.Set(nova.db, 'instance_get_by_uuid', return_server_by_uuid)
        self.stubs.Set(nova.db, 'instance_update', instance_update)

        fakes.stub_out_glance(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)
        self.backup = fakes.stub_out_compute_api_backup(self.stubs)
        service_class = 'nova.image.glance.GlanceImageService'
        self.service = utils.import_object(service_class)
        self.context = context.RequestContext(1, None)
        self.service.delete_all()
        self.sent_to_glance = {}
        fakes.stub_out_glance_add_image(self.stubs, self.sent_to_glance)
        self.flags(allow_instance_snapshots=True)
        self.uuid = FAKE_UUID
        self.url = '/v1.1/fake/servers/%s/action' % self.uuid

        self.controller = servers.Controller()
Ejemplo n.º 14
0
    def setUp(self):
        self.maxDiff = None
        super(ServerActionsControllerTest, self).setUp()

        self.stubs = stubout.StubOutForTesting()
        fakes.stub_out_auth(self.stubs)
        self.stubs.Set(nova.db, 'instance_get', return_server_by_id)
        self.stubs.Set(nova.db, 'instance_get_by_uuid', return_server_by_uuid)
        self.stubs.Set(nova.db, 'instance_update', instance_update)

        fakes.stub_out_glance(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)
        self.backup = fakes.stub_out_compute_api_backup(self.stubs)
        service_class = 'nova.image.glance.GlanceImageService'
        self.service = utils.import_object(service_class)
        self.context = context.RequestContext(1, None)
        self.service.delete_all()
        self.sent_to_glance = {}
        fakes.stub_out_glance_add_image(self.stubs, self.sent_to_glance)
        self.flags(allow_instance_snapshots=True)
        self.uuid = FAKE_UUID
        self.url = '/v2/fake/servers/%s/action' % self.uuid

        self.controller = servers.Controller()
Ejemplo n.º 15
0
 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)
Ejemplo n.º 16
0
    def setUp(self):
        self.maxDiff = None
        super(ServerActionsControllerTest, self).setUp()

        self.stubs = stubout.StubOutForTesting()
        fakes.stub_out_auth(self.stubs)
        self.stubs.Set(
            nova.db, 'instance_get_by_uuid',
            fakes.fake_instance_get(vm_state=vm_states.ACTIVE,
                                    host='fake_host'))
        self.stubs.Set(nova.db, 'instance_update', instance_update)

        fakes.stub_out_glance(self.stubs)
        fakes.stub_out_nw_api(self.stubs)
        fakes.stub_out_rate_limiting(self.stubs)
        fakes.stub_out_compute_api_snapshot(self.stubs)
        fakes.stub_out_image_service(self.stubs)
        service_class = 'nova.image.glance.GlanceImageService'
        self.service = utils.import_object(service_class)
        self.context = context.RequestContext(1, None)
        self.service.delete_all()
        self.sent_to_glance = {}
        fakes.stub_out_glance_add_image(self.stubs, self.sent_to_glance)
        self.flags(allow_instance_snapshots=True,
                   enable_instance_password=True)
        self.uuid = FAKE_UUID
        self.url = '/v2/fake/servers/%s/action' % self.uuid
        self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6'

        self.controller = servers.Controller()
Ejemplo n.º 17
0
    def setUp(self):
        super(ServerActionsControllerTest, self).setUp()

        self.stubs.Set(nova.db, 'instance_get_by_uuid',
                       fakes.fake_instance_get(vm_state=vm_states.ACTIVE,
                                               host='fake_host'))
        self.stubs.Set(nova.db, 'instance_update_and_get_original',
                       instance_update)

        fakes.stub_out_glance(self.stubs)
        fakes.stub_out_nw_api(self.stubs)
        fakes.stub_out_rate_limiting(self.stubs)
        fakes.stub_out_compute_api_snapshot(self.stubs)
        nova.tests.image.fake.stub_out_image_service(self.stubs)
        service_class = 'nova.image.glance.GlanceImageService'
        self.service = importutils.import_object(service_class)
        self.sent_to_glance = {}
        fakes.stub_out_glanceclient_create(self.stubs, self.sent_to_glance)
        self.flags(allow_instance_snapshots=True,
                   enable_instance_password=True)
        self.uuid = FAKE_UUID
        self.url = '/v2/fake/servers/%s/action' % self.uuid
        self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6'

        self.controller = servers.Controller()
Ejemplo n.º 18
0
 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)
Ejemplo n.º 19
0
    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)
Ejemplo n.º 20
0
 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)
Ejemplo n.º 21
0
 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)
Ejemplo n.º 22
0
 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)
Ejemplo n.º 23
0
 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)
Ejemplo n.º 24
0
 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)
Ejemplo n.º 25
0
    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)
Ejemplo n.º 26
0
 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()
Ejemplo n.º 27
0
    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()
Ejemplo n.º 28
0
 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_rate_limiting(self.stubs)
     fakes.stub_out_networking(self.stubs)
Ejemplo n.º 29
0
 def setUp(self):
     super(Test, self).setUp()
     self.stubs.Set(nova.api.openstack.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)
Ejemplo n.º 30
0
 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)
Ejemplo n.º 31
0
 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()
Ejemplo n.º 32
0
 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)
Ejemplo n.º 33
0
 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
Ejemplo n.º 34
0
 def setUp(self):
     """Run before each test."""
     super(ImagesTest, self).setUp()
     self.stubs = stubout.StubOutForTesting()
     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)
Ejemplo n.º 35
0
 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'])
Ejemplo n.º 36
0
 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)
Ejemplo n.º 37
0
 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.app = fakes.wsgi_app_v3(init_only=('servers', 'os-multinic'))
Ejemplo n.º 39
0
    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)
Ejemplo n.º 40
0
 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()
Ejemplo n.º 41
0
 def setUp(self):
     super(FlavorsTestV21, 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 = self.Controller()
Ejemplo n.º 42
0
 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)
Ejemplo n.º 43
0
 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'])
Ejemplo n.º 44
0
 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)
Ejemplo n.º 45
0
    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)
Ejemplo n.º 46
0
    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()
Ejemplo n.º 47
0
    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()
Ejemplo n.º 48
0
    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()
Ejemplo n.º 49
0
    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()
Ejemplo n.º 50
0
    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()
Ejemplo n.º 51
0
 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)
Ejemplo n.º 52
0
    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()
Ejemplo n.º 53
0
 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)
Ejemplo n.º 54
0
    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()
Ejemplo n.º 55
0
 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)
Ejemplo n.º 56
0
    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()
Ejemplo n.º 57
0
 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()
Ejemplo n.º 58
0
 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', ))