def setUp(self): super(HostTestCase, self).setUp() self.controller = os_hosts.HostController() self.req = FakeRequest() self.stubs.Set(scheduler_api, 'get_host_list', stub_get_host_list) self.stubs.Set(self.controller.compute_api, 'set_host_enabled', stub_set_host_enabled) self.stubs.Set(self.controller.compute_api, 'host_power_action', stub_host_power_action)
def setUp(self): super(HostTestCase, self).setUp() self.controller = os_hosts.HostController() self.req = FakeRequest() self.stubs.Set(db, 'service_get_all', stub_service_get_all) self.stubs.Set(self.controller.api, 'set_host_enabled', stub_set_host_enabled) self.stubs.Set(self.controller.api, 'set_host_maintenance', stub_set_host_maintenance) self.stubs.Set(self.controller.api, 'host_power_action', stub_host_power_action)
def setUp(self): super(HostTestCase, self).setUp() self.controller = os_hosts.HostController() self.req = FakeRequest() self.stubs.Set(scheduler_rpcapi.SchedulerAPI, 'get_host_list', stub_get_host_list) self.stubs.Set(self.controller.api, 'set_host_enabled', stub_set_host_enabled) self.stubs.Set(self.controller.api, 'set_host_maintenance', stub_set_host_maintenance) self.stubs.Set(self.controller.api, 'host_power_action', stub_host_power_action)
def setUp(self): super(HostTestCase, self).setUp() self.controller = os_hosts.HostController() self.hosts_api = self.controller.api self.req = FakeRequest() # Pretend we have fake_hosts.HOST_LIST in the DB self.stubs.Set(db, 'service_get_all', stub_service_get_all) # Only hosts in our fake DB exist self.stubs.Set(db, 'service_get_by_host_and_topic', stub_service_get_by_host_and_topic) # 'host_c1' always succeeds, and 'host_c2' self.stubs.Set(self.hosts_api, 'set_host_enabled', stub_set_host_enabled) # 'host_c1' always succeeds, and 'host_c2' self.stubs.Set(self.hosts_api, 'set_host_maintenance', stub_set_host_maintenance) self.stubs.Set(self.hosts_api, 'host_power_action', stub_host_power_action)