diff options
author | jichenjc <jichenjc@cn.ibm.com> | 2016-01-13 08:08:20 +0800 |
---|---|---|
committer | jichenjc <jichenjc@cn.ibm.com> | 2016-01-13 10:36:59 +0800 |
commit | 09b19d8e43f792d4d310680f764d6cf29b377b86 (patch) | |
tree | 2da3f32c201e5292875b5d0e0d51669680a1850b /nova/tests/unit/console | |
parent | 34cf19c8a4dababd1e723c0364a80823c0ac2637 (diff) | |
download | nova-09b19d8e43f792d4d310680f764d6cf29b377b86.tar.gz |
Stop using mox stubs in nova.tests.unit.console
remove stubs with newly introduced stub_out function
also use mock to replace old mox in console subfolder.
Part of blueprint remove-mox
Change-Id: Id4317ec0635f2acd85e839352b7c7ea7d9d35292
Diffstat (limited to 'nova/tests/unit/console')
-rw-r--r-- | nova/tests/unit/console/test_console.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/nova/tests/unit/console/test_console.py b/nova/tests/unit/console/test_console.py index c44237140f..381bbe47d3 100644 --- a/nova/tests/unit/console/test_console.py +++ b/nova/tests/unit/console/test_console.py @@ -22,7 +22,6 @@ from oslo_utils import importutils from nova.compute import rpcapi as compute_rpcapi from nova.console import api as console_api -from nova.console import rpcapi as console_rpcapi from nova import context from nova import db from nova import exception @@ -148,12 +147,12 @@ class ConsoleAPITestCase(test.TestCase): def _fake_db_console_get(_ctxt, _console_uuid, _instance_uuid): return self.fake_console - self.stubs.Set(db, 'console_get', _fake_db_console_get) + self.stub_out('nova.db.console_get', _fake_db_console_get) def _fake_db_console_get_all_by_instance(_ctxt, _instance_uuid, columns_to_join): return [self.fake_console] - self.stubs.Set(db, 'console_get_all_by_instance', + self.stub_out('nova.db.console_get_all_by_instance', _fake_db_console_get_all_by_instance) def test_get_consoles(self): @@ -165,15 +164,11 @@ class ConsoleAPITestCase(test.TestCase): 'fake_id') self.assertEqual(console, self.fake_console) - def test_delete_console(self): - self.mox.StubOutWithMock(console_rpcapi.ConsoleAPI, 'remove_console') - - console_rpcapi.ConsoleAPI.remove_console(self.context, 'fake_id') - - self.mox.ReplayAll() - + @mock.patch('nova.console.rpcapi.ConsoleAPI.remove_console') + def test_delete_console(self, mock_remove): self.console_api.delete_console(self.context, self.fake_uuid, 'fake_id') + mock_remove.assert_called_once_with(self.context, 'fake_id') @mock.patch.object(compute_rpcapi.ComputeAPI, 'get_console_topic', return_value='compute.fake_host') |