@@ -483,7 +483,7 @@ def test_non_unicode_encoding_locale_warning_is_printed(self, mock_logger):
483483 shell = Shell ()
484484 shell .run (argv = ["trigger" , "list" ])
485485
486- call_args = mock_logger .warn .call_args [0 ][0 ]
486+ call_args = mock_logger .warning .call_args [0 ][0 ]
487487 self .assertIn (
488488 "Locale en_US with encoding iso which is not UTF-8 is used." , call_args
489489 )
@@ -502,7 +502,7 @@ def test_failed_to_get_locale_encoding_warning_is_printed(self, mock_logger):
502502 shell = Shell ()
503503 shell .run (argv = ["trigger" , "list" ])
504504
505- call_args = mock_logger .warn .call_args [0 ][0 ]
505+ call_args = mock_logger .warning .call_args [0 ][0 ]
506506 self .assertTrue (
507507 "Locale unknown with encoding unknown which is not UTF-8 is used."
508508 in call_args
@@ -542,13 +542,13 @@ def test_dont_warn_multiple_times(self):
542542 # Test without token.
543543 shell .run (["--config-file" , mock_config_path , "action" , "list" ])
544544
545- self .assertEqual (shell .LOG .warn .call_count , 2 )
545+ self .assertEqual (shell .LOG .warning .call_count , 2 )
546546 self .assertEqual (
547- shell .LOG .warn .call_args_list [0 ][0 ][0 ][:63 ],
547+ shell .LOG .warning .call_args_list [0 ][0 ][0 ][:63 ],
548548 "The StackStorm configuration directory permissions are insecure" ,
549549 )
550550 self .assertEqual (
551- shell .LOG .warn .call_args_list [1 ][0 ][0 ][:58 ],
551+ shell .LOG .warning .call_args_list [1 ][0 ][0 ][:58 ],
552552 "The StackStorm configuration file permissions are insecure" ,
553553 )
554554
@@ -617,6 +617,7 @@ def _write_mock_config(self):
617617 with open (self ._mock_config_path , "w" ) as fp :
618618 fp .write (MOCK_CONFIG )
619619
620+ @unittest .skipIf (os .getuid () == 0 , reason = "Test must be run as non-root user." )
620621 def test_get_cached_auth_token_invalid_permissions (self ):
621622 shell = Shell ()
622623 client = Client ()
@@ -637,8 +638,8 @@ def test_get_cached_auth_token_invalid_permissions(self):
637638 )
638639
639640 self .assertEqual (result , None )
640- self .assertEqual (shell .LOG .warn .call_count , 1 )
641- log_message = shell .LOG .warn .call_args [0 ][0 ]
641+ self .assertEqual (shell .LOG .warning .call_count , 1 )
642+ log_message = shell .LOG .warning .call_args [0 ][0 ]
642643
643644 expected_msg = (
644645 "Unable to retrieve cached token from .*? read access to the parent "
@@ -656,8 +657,8 @@ def test_get_cached_auth_token_invalid_permissions(self):
656657 )
657658 self .assertEqual (result , None )
658659
659- self .assertEqual (shell .LOG .warn .call_count , 1 )
660- log_message = shell .LOG .warn .call_args [0 ][0 ]
660+ self .assertEqual (shell .LOG .warning .call_count , 1 )
661+ log_message = shell .LOG .warning .call_args [0 ][0 ]
661662
662663 expected_msg = (
663664 "Unable to retrieve cached token from .*? read access to this file"
@@ -674,12 +675,13 @@ def test_get_cached_auth_token_invalid_permissions(self):
674675 )
675676 self .assertEqual (result , "yayvalid" )
676677
677- self .assertEqual (shell .LOG .warn .call_count , 1 )
678- log_message = shell .LOG .warn .call_args [0 ][0 ]
678+ self .assertEqual (shell .LOG .warning .call_count , 1 )
679+ log_message = shell .LOG .warning .call_args [0 ][0 ]
679680
680681 expected_msg = "Permissions .*? for cached token file .*? are too permissive.*"
681682 self .assertRegex (log_message , expected_msg )
682683
684+ @unittest .skipIf (os .getuid () == 0 , reason = "Test must be run as non-root user." )
683685 def test_cache_auth_token_invalid_permissions (self ):
684686 shell = Shell ()
685687 username = "testu"
@@ -700,8 +702,8 @@ def test_cache_auth_token_invalid_permissions(self):
700702 shell .LOG = mock .Mock ()
701703 shell ._cache_auth_token (token_obj = token_db )
702704
703- self .assertEqual (shell .LOG .warn .call_count , 1 )
704- log_message = shell .LOG .warn .call_args [0 ][0 ]
705+ self .assertEqual (shell .LOG .warning .call_count , 1 )
706+ log_message = shell .LOG .warning .call_args [0 ][0 ]
705707
706708 expected_msg = (
707709 "Unable to write token to .*? doesn't have write access to the parent "
@@ -716,8 +718,8 @@ def test_cache_auth_token_invalid_permissions(self):
716718 shell .LOG = mock .Mock ()
717719 shell ._cache_auth_token (token_obj = token_db )
718720
719- self .assertEqual (shell .LOG .warn .call_count , 1 )
720- log_message = shell .LOG .warn .call_args [0 ][0 ]
721+ self .assertEqual (shell .LOG .warning .call_count , 1 )
722+ log_message = shell .LOG .warning .call_args [0 ][0 ]
721723
722724 expected_msg = (
723725 "Unable to write token to .*? doesn't have write access to this file"
0 commit comments