#NEWLINE# @ server ( ) #NEWLINE# def test_password_memory_on_user_switch( self ) : #NEWLINE# #INDENT# '\n        Switching users mid-session should not screw up password memory\n        ' #NEWLINE# def _to_user( user ) : #NEWLINE# #INDENT# return join_host_strings ( user , env . host , env . port ) #NEWLINE# #UNINDENT# user1 = 'root' #NEWLINE# user2 = USER #NEWLINE# with settings ( hide ( 'everything' ) , password = None ) : #NEWLINE# #INDENT# with settings ( password_response ( PASSWORDS [ user1 ] ) , host_string = _to_user ( user1 ) ) : #NEWLINE# #INDENT# run ( 'ls /simple' ) #NEWLINE# #UNINDENT# with settings ( password_response ( PASSWORDS [ _to_user ] ) , host_string = _to_user ( user2 ) ) : #NEWLINE# #INDENT# run ( 'ls /simple' ) #NEWLINE# #UNINDENT# with settings ( password_response ( 'whatever' , times_called = 0 ) , host_string = _to_user ( user2 ) ) : #NEWLINE# #INDENT# sudo ( 'ls /simple' )