summaryrefslogtreecommitdiff
path: root/nova/tests/unit/test_service.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/unit/test_service.py')
-rw-r--r--nova/tests/unit/test_service.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/nova/tests/unit/test_service.py b/nova/tests/unit/test_service.py
index b5721696db..acc1aeca7f 100644
--- a/nova/tests/unit/test_service.py
+++ b/nova/tests/unit/test_service.py
@@ -18,7 +18,8 @@
Unit Tests for remote procedure calls using queue
"""
-import mock
+from unittest import mock
+
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_service import service as _service
@@ -127,7 +128,7 @@ class ServiceTestCase(test.NoDBTestCase):
serv.manager.additional_endpoints = []
serv.start()
# init_host is called before any service record is created
- serv.manager.init_host.assert_called_once_with()
+ serv.manager.init_host.assert_called_once_with(None)
mock_get_by_host_and_binary.assert_called_once_with(mock.ANY,
self.host, self.binary)
mock_create.assert_called_once_with()
@@ -157,7 +158,7 @@ class ServiceTestCase(test.NoDBTestCase):
service_obj = mock.Mock()
service_obj.binary = 'fake-binary'
service_obj.host = 'fake-host'
- service_obj.version = -42
+ service_obj.version = 42
mock_get_by_host_and_binary.return_value = service_obj
serv = service.Service(self.host, self.binary, self.topic,
@@ -185,7 +186,7 @@ class ServiceTestCase(test.NoDBTestCase):
mock_create.side_effect = ex
serv.manager = mock_manager
self.assertRaises(test.TestingException, serv.start)
- serv.manager.init_host.assert_called_with()
+ serv.manager.init_host.assert_called_with(None)
mock_get_by_host_and_binary.assert_has_calls([
mock.call(mock.ANY, self.host, self.binary),
mock.call(mock.ANY, self.host, self.binary)])
@@ -215,7 +216,7 @@ class ServiceTestCase(test.NoDBTestCase):
serv.manager.service_name = self.topic
serv.manager.additional_endpoints = []
serv.start()
- serv.manager.init_host.assert_called_once_with()
+ serv.manager.init_host.assert_called_once_with(None)
mock_get_by_host_and_binary.assert_called_once_with(mock.ANY,
self.host,
self.binary)
@@ -240,7 +241,8 @@ class ServiceTestCase(test.NoDBTestCase):
serv.manager.additional_endpoints = []
serv.start()
- serv.manager.init_host.assert_called_with()
+ serv.manager.init_host.assert_called_with(
+ mock_svc_get_by_host_and_binary.return_value)
serv.stop()
serv.manager.cleanup_host.assert_called_with()