From be108b3cdde65ecee408732610f8a65ebedaf62b Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 14 Mar 2024 00:32:57 +0100 Subject: [PATCH] Replace 'warn' with 'warning' method --- st2client/tests/unit/test_shell.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/st2client/tests/unit/test_shell.py b/st2client/tests/unit/test_shell.py index e3950e11f6..afecdee6c5 100644 --- a/st2client/tests/unit/test_shell.py +++ b/st2client/tests/unit/test_shell.py @@ -483,7 +483,7 @@ def test_non_unicode_encoding_locale_warning_is_printed(self, mock_logger): shell = Shell() shell.run(argv=["trigger", "list"]) - call_args = mock_logger.warn.call_args[0][0] + call_args = mock_logger.warning.call_args[0][0] self.assertIn( "Locale en_US with encoding iso which is not UTF-8 is used.", call_args ) @@ -502,7 +502,7 @@ def test_failed_to_get_locale_encoding_warning_is_printed(self, mock_logger): shell = Shell() shell.run(argv=["trigger", "list"]) - call_args = mock_logger.warn.call_args[0][0] + call_args = mock_logger.warning.call_args[0][0] self.assertTrue( "Locale unknown with encoding unknown which is not UTF-8 is used." in call_args @@ -542,13 +542,13 @@ def test_dont_warn_multiple_times(self): # Test without token. shell.run(["--config-file", mock_config_path, "action", "list"]) - self.assertEqual(shell.LOG.warn.call_count, 2) + self.assertEqual(shell.LOG.warning.call_count, 2) self.assertEqual( - shell.LOG.warn.call_args_list[0][0][0][:63], + shell.LOG.warning.call_args_list[0][0][0][:63], "The StackStorm configuration directory permissions are insecure", ) self.assertEqual( - shell.LOG.warn.call_args_list[1][0][0][:58], + shell.LOG.warning.call_args_list[1][0][0][:58], "The StackStorm configuration file permissions are insecure", ) @@ -637,8 +637,8 @@ def test_get_cached_auth_token_invalid_permissions(self): ) self.assertEqual(result, None) - self.assertEqual(shell.LOG.warn.call_count, 1) - log_message = shell.LOG.warn.call_args[0][0] + self.assertEqual(shell.LOG.warning.call_count, 1) + log_message = shell.LOG.warning.call_args[0][0] expected_msg = ( "Unable to retrieve cached token from .*? read access to the parent " @@ -656,8 +656,8 @@ def test_get_cached_auth_token_invalid_permissions(self): ) self.assertEqual(result, None) - self.assertEqual(shell.LOG.warn.call_count, 1) - log_message = shell.LOG.warn.call_args[0][0] + self.assertEqual(shell.LOG.warning.call_count, 1) + log_message = shell.LOG.warning.call_args[0][0] expected_msg = ( "Unable to retrieve cached token from .*? read access to this file" @@ -674,8 +674,8 @@ def test_get_cached_auth_token_invalid_permissions(self): ) self.assertEqual(result, "yayvalid") - self.assertEqual(shell.LOG.warn.call_count, 1) - log_message = shell.LOG.warn.call_args[0][0] + self.assertEqual(shell.LOG.warning.call_count, 1) + log_message = shell.LOG.warning.call_args[0][0] expected_msg = "Permissions .*? for cached token file .*? are too permissive.*" self.assertRegex(log_message, expected_msg) @@ -700,8 +700,8 @@ def test_cache_auth_token_invalid_permissions(self): shell.LOG = mock.Mock() shell._cache_auth_token(token_obj=token_db) - self.assertEqual(shell.LOG.warn.call_count, 1) - log_message = shell.LOG.warn.call_args[0][0] + self.assertEqual(shell.LOG.warning.call_count, 1) + log_message = shell.LOG.warning.call_args[0][0] expected_msg = ( "Unable to write token to .*? doesn't have write access to the parent " @@ -716,8 +716,8 @@ def test_cache_auth_token_invalid_permissions(self): shell.LOG = mock.Mock() shell._cache_auth_token(token_obj=token_db) - self.assertEqual(shell.LOG.warn.call_count, 1) - log_message = shell.LOG.warn.call_args[0][0] + self.assertEqual(shell.LOG.warning.call_count, 1) + log_message = shell.LOG.warning.call_args[0][0] expected_msg = ( "Unable to write token to .*? doesn't have write access to this file"