Пример #1
0
    def setUp(self):
        def fake_get_nw_info(cls, ctxt, instance):
            self.assertTrue(ctxt.is_admin)
            return fake_network.fake_get_instance_nw_info(self.stubs, 1, 1)

        super(UsageInfoTestCase, self).setUp()
        self.stubs.Set(network_api.API, 'get_instance_nw_info',
                       fake_get_nw_info)

        fake_notifier.stub_notifier(self.stubs)
        self.addCleanup(fake_notifier.reset)

        self.flags(use_local=True, group='conductor')
        self.flags(compute_driver='nova.virt.fake.FakeDriver',
                   network_manager='nova.network.manager.FlatManager')
        self.compute = importutils.import_object(CONF.compute_manager)
        self.user_id = 'fake'
        self.project_id = 'fake'
        self.context = context.RequestContext(self.user_id, self.project_id)

        def fake_show(meh, context, id, **kwargs):
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.stubs.Set(nova.tests.image.fake._FakeImageService,
                       'show', fake_show)
        fake_network.set_stub_network_methods(self.stubs)
        fake_server_actions.stub_out_action_events(self.stubs)
Пример #2
0
    def setUp(self):
        def fake_get_nw_info(cls, ctxt, instance):
            self.assertTrue(ctxt.is_admin)
            return fake_network.fake_get_instance_nw_info(self.stubs, 1, 1)

        super(UsageInfoTestCase, self).setUp()
        self.stubs.Set(network_api.API, 'get_instance_nw_info',
                       fake_get_nw_info)

        fake_notifier.stub_notifier(self.stubs)
        self.addCleanup(fake_notifier.reset)

        self.flags(use_local=True, group='conductor')
        self.flags(compute_driver='nova.virt.fake.FakeDriver',
                   network_manager='nova.network.manager.FlatManager')
        self.compute = importutils.import_object(CONF.compute_manager)
        self.user_id = 'fake'
        self.project_id = 'fake'
        self.context = context.RequestContext(self.user_id, self.project_id)

        def fake_show(meh, context, id, **kwargs):
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.stubs.Set(nova.tests.image.fake._FakeImageService, 'show',
                       fake_show)
        fake_network.set_stub_network_methods(self.stubs)
        fake_server_actions.stub_out_action_events(self.stubs)
Пример #3
0
 def setUp(self):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(scheduler_driver=self.driver_cls_name)
     self.stubs.Set(compute_api, 'API', fakes.FakeComputeAPI)
     self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self.stubs)
Пример #4
0
 def setUp(self):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(scheduler_driver=self.driver_cls_name)
     self.stubs.Set(compute_api, "API", fakes.FakeComputeAPI)
     self.manager = self.manager_cls()
     self.context = context.RequestContext("fake_user", "fake_project")
     self.topic = "fake_topic"
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {"cat": "meow", "dog": "woof"}
     fake_server_actions.stub_out_action_events(self.stubs)
Пример #5
0
 def setUp(self):
     super(SchedulerManagerTestCase, self).setUp()
     self.flags(scheduler_driver=self.driver_cls_name)
     self.stubs.Set(compute_api, 'API', fakes.FakeComputeAPI)
     self.manager = self.manager_cls()
     self.context = context.RequestContext('fake_user', 'fake_project')
     self.topic = 'fake_topic'
     self.fake_args = (1, 2, 3)
     self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
     fake_server_actions.stub_out_action_events(self.stubs)