File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -998,7 +998,8 @@ def option_repr(option, value):
998998 options .extend (
999999 option_repr (key , self .__options ._options [key ])
10001000 for key in self .__options ._options
1001- if key not in set (self ._constructor_args ))
1001+ if key not in set (self ._constructor_args )
1002+ and key != 'username' and key != 'password' )
10021003 return ', ' .join (options )
10031004
10041005 def __repr__ (self ):
Original file line number Diff line number Diff line change @@ -597,7 +597,16 @@ def test_username_and_password(self):
597597 self .client .admin .add_user ("ad min" , "pa/ss" , roles = ["root" ])
598598 self .addCleanup (self .client .admin .remove_user , "ad min" )
599599
600- rs_or_single_client (username = "ad min" , password = "pa/ss" ).server_info ()
600+ c = rs_or_single_client (username = "ad min" , password = "pa/ss" )
601+
602+ # Username and password aren't in strings that will likely be logged.
603+ self .assertNotIn ("ad min" , repr (c ))
604+ self .assertNotIn ("ad min" , str (c ))
605+ self .assertNotIn ("pa/ss" , repr (c ))
606+ self .assertNotIn ("pa/ss" , str (c ))
607+
608+ # Auth succeeds.
609+ c .server_info ()
601610
602611 with self .assertRaises (OperationFailure ):
603612 rs_or_single_client (username = "ad min" , password = "foo" ).server_info ()
You can’t perform that action at this time.
0 commit comments