Skip to content

Commit

Permalink
Replace 'warn' with 'warning' method
Browse files Browse the repository at this point in the history
  • Loading branch information
nzlosh committed Mar 13, 2024
1 parent 5dcc31c commit be108b3
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions st2client/tests/unit/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
Expand Down Expand Up @@ -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",
)

Expand Down Expand Up @@ -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 "
Expand All @@ -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"
Expand All @@ -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)
Expand All @@ -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 "
Expand All @@ -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"
Expand Down

0 comments on commit be108b3

Please sign in to comment.