3838# Imports required for the unit test wrapping
3939from mig .shared .base import client_id_dir , distinguished_name_to_user
4040from mig .shared .defaults import (
41- DEFAULT_USER_ID_FORMAT , UUID_USER_ID_FORMAT ,
41+ DEFAULT_USER_ID_FORMAT ,
42+ UUID_USER_ID_FORMAT ,
4243 htaccess_filename ,
4344 keyword_auto ,
4445 ssh_conf_dir ,
@@ -660,7 +661,7 @@ def test_user_creation_records_a_user_with_gdp(self):
660661 create_user (
661662 user_dict , self .configuration , keyword_auto , default_renew = True
662663 )
663- except :
664+ except Exception :
664665 self .assertFalse (True , "should not be reached" )
665666
666667 def test_user_creation_and_renew_records_a_user (self ):
@@ -685,7 +686,7 @@ def test_user_creation_and_renew_records_a_user(self):
685686 default_renew = True ,
686687 ask_renew = False ,
687688 )
688- except :
689+ except Exception :
689690 self .assertFalse (True , "should not be reached" )
690691
691692 try :
@@ -696,7 +697,7 @@ def test_user_creation_and_renew_records_a_user(self):
696697 default_renew = True ,
697698 ask_renew = False ,
698699 )
699- except :
700+ except Exception :
700701 self .assertFalse (True , "should not be reached" )
701702
702703 def test_user_creation_fails_in_renew_when_locked (self ):
@@ -724,7 +725,7 @@ def test_user_creation_fails_in_renew_when_locked(self):
724725 default_renew = True ,
725726 ask_renew = False ,
726727 )
727- except :
728+ except Exception :
728729 self .assertFalse (True , "should not be reached" )
729730
730731 def test_user_creation_with_id_collission_fails (self ):
@@ -743,7 +744,7 @@ def test_user_creation_with_id_collission_fails(self):
743744 create_user (
744745 user_dict , self .configuration , keyword_auto , default_renew = True
745746 )
746- except :
747+ except Exception :
747748 self .assertFalse (True , "should not be reached" )
748749
749750 # NOTE: reset distinguished_name and introduce an ID conflict to test
@@ -782,7 +783,7 @@ def assertHtaccessRequireUserClause(self, generated, expected):
782783 generated = htaccess_file .read ()
783784
784785 generated_lines = generated .split ("\n " )
785- if not expected in generated_lines :
786+ if expected not in generated_lines :
786787 raise AssertionError ("no such require user line: %s" % expected )
787788
788789 def test_skips_accounts_without_short_id (self ):
@@ -796,7 +797,7 @@ def test_skips_accounts_without_short_id(self):
796797 path_kind = self .assertPathExists (DUMMY_REL_HTACCESS_PATH )
797798 # File should not exist here at all
798799 self .assertNotEqual (path_kind , "file" )
799- except OSError as ignore_oserr :
800+ except OSError :
800801 pass
801802
802803 def test_creates_missing_htaccess_file (self ):
@@ -989,14 +990,10 @@ def test_user_deletion_removes_fs_entries(self):
989990 self .assertFalse (os .path .exists (short_link ))
990991
991992 settings_dir = os .path .join (self .configuration .user_settings ,
992- TEST_USER_UUID )
993+ TEST_USER_DIR )
993994 self .assertFalse (os .path .isdir (settings_dir ))
994995 self .assertFalse (os .path .exists (settings_dir ))
995- settings_link = os .path .join (self .configuration .user_settings ,
996- TEST_USER_DIR )
997- self .assertFalse (os .path .islink (settings_link ))
998- self .assertFalse (os .path .exists (settings_link ))
999-
996+
1000997 ssh_dir = os .path .join (home_dir , ssh_conf_dir )
1001998 self .assertFalse (os .path .isdir (ssh_dir ))
1002999 self .assertFalse (os .path .exists (ssh_dir ))
0 commit comments