From 047cb6849354f4fdf8d365bd109a0ed56a77d200 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Thu, 16 Jun 2016 20:01:15 +0800 Subject: Standardize logger usage Use file logger for all command specific logs. This patch also fixes some usage that doesn't follow rules in: http://docs.openstack.org/developer/oslo.i18n/guidelines.html After this patch, all self.log and self.app.log will be standardized to LOG(). NOTE: In shell.py, we got the log in class OpenStackShell, which is also known as self.app.log in other classes. This logger is used to record non-command-specific logs. So we leave it as-is. Change-Id: I114f73ee6c7e84593d71e724bc1ad00d343c1896 Implements: blueprint log-usage --- openstackclient/tests/compute/v2/test_service.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/compute/v2/test_service.py b/openstackclient/tests/compute/v2/test_service.py index b360c9dc..3afe964f 100644 --- a/openstackclient/tests/compute/v2/test_service.py +++ b/openstackclient/tests/compute/v2/test_service.py @@ -330,12 +330,9 @@ class TestServiceSet(TestService): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - with mock.patch.object(self.cmd.log, 'error') as mock_log: - with mock.patch.object(self.service_mock, 'enable', - side_effect=Exception()): - self.assertRaises(exceptions.CommandError, - self.cmd.take_action, parsed_args) - mock_log.assert_called_once_with( - "Failed to set service status to %s", "enabled") - self.service_mock.force_down.assert_called_once_with( - self.service.host, self.service.binary, force_down=True) + with mock.patch.object(self.service_mock, 'enable', + side_effect=Exception()): + self.assertRaises(exceptions.CommandError, + self.cmd.take_action, parsed_args) + self.service_mock.force_down.assert_called_once_with( + self.service.host, self.service.binary, force_down=True) -- cgit v1.2.1