From 33f6ff204adea2a66564c88cccee32308919da16 Mon Sep 17 00:00:00 2001 From: Takashi NATSUME Date: Fri, 6 Apr 2018 14:19:10 +0900 Subject: [PATCH] Remove mox in unit/api/openstack/compute/test_hosts.py Replace stubs.Set with mock in nova/tests/unit/api/openstack/compute/test_hosts.py. Change-Id: Id0e4c76bdda6a518429c50b5ce12354a315ed9dd Implements: blueprint mox-removal --- .../unit/api/openstack/compute/test_hosts.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nova/tests/unit/api/openstack/compute/test_hosts.py b/nova/tests/unit/api/openstack/compute/test_hosts.py index b7a85d9a3fe0..d7464b43614b 100644 --- a/nova/tests/unit/api/openstack/compute/test_hosts.py +++ b/nova/tests/unit/api/openstack/compute/test_hosts.py @@ -40,7 +40,7 @@ def stub_service_get_by_host_and_binary(context, host_name, binary): return service -def stub_set_host_enabled(context, host_name, enabled): +def stub_set_host_enabled(self, context, host_name, enabled): """Simulates three possible behaviours for VM drivers or compute drivers when enabling or disabling a host. @@ -65,7 +65,7 @@ def stub_set_host_enabled(context, host_name, enabled): return results[enabled] -def stub_set_host_maintenance(context, host_name, mode): +def stub_set_host_maintenance(self, context, host_name, mode): # We'll simulate success and failure by assuming # that 'host_c1' always succeeds, and 'host_c2' # always fails @@ -87,7 +87,7 @@ def stub_set_host_maintenance(context, host_name, mode): return results[mode] -def stub_host_power_action(context, host_name, action): +def stub_host_power_action(self, context, host_name, action): if host_name == "notimplemented": raise NotImplementedError() elif host_name == "dummydest": @@ -142,13 +142,13 @@ class HostTestCaseV21(test.TestCase): self.stub_out('nova.db.service_get_by_host_and_binary', stub_service_get_by_host_and_binary) # 'host_c1' always succeeds, and 'host_c2' - self.stubs.Set(self.hosts_api, 'set_host_enabled', - stub_set_host_enabled) + self.stub_out('nova.compute.api.HostAPI.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) + self.stub_out('nova.compute.api.HostAPI.set_host_maintenance', + stub_set_host_maintenance) + self.stub_out('nova.compute.api.HostAPI.host_power_action', + stub_host_power_action) def setUp(self): super(HostTestCaseV21, self).setUp()