#NEWLINE# @ mock_streams ( 'both' ) #NEWLINE# @ server ( pubkeys = True , responses = { #NEWLINE# #INDENT# 'oneliner' : 'result' , #NEWLINE# 'twoliner' : 'result1\nresult2' , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_io_should_print_prefix_if_ouput_prefix_is_true( self ) : #NEWLINE# #INDENT# '\n        run/sudo should print [host_string] if env.output_prefix == True\n        ' #NEWLINE# env . password = None #NEWLINE# env . no_agent = env . no_keys = True #NEWLINE# env . key_filename = CLIENT_PRIVKEY #NEWLINE# with password_response ( ( CLIENT_PRIVKEY_PASSPHRASE , PASSWORDS [ USER ] ) , silent = False ) : #NEWLINE# #INDENT# run ( 'oneliner' ) #NEWLINE# run ( 'twoliner' ) #NEWLINE# #UNINDENT# expected = ( "\n[%(prefix)s] run: oneliner\n[%(prefix)s] Login password for '%(user)s': \n[%(prefix)s] out: result\n[%(prefix)s] run: twoliner\n[%(prefix)s] out: result1\n[%(prefix)s] out: result2\n" % { #NEWLINE# #INDENT# 'prefix' : env . host_string , #NEWLINE# 'user' : env . user , #NEWLINE# #UNINDENT# } ) #NEWLINE# eq_ ( expected [ 1 : ] , sys . stdall . getvalue ( ) )