#NEWLINE# @ patch ( 'fabtools.files.sudo' ) #NEWLINE# @ patch ( 'fabtools.files._upload_template' ) #NEWLINE# def test_mkdir_sudo_user( self , mock_upload_template , mock_sudo ) : #NEWLINE# #INDENT# from fabtools.files import upload_template #NEWLINE# upload_template ( 'filename' , '/path/to/destination' , mkdir = True , use_sudo = True , user = 'alice' ) #NEWLINE# ( args , kwargs ) = mock_sudo . call_args #NEWLINE# self . assertEqual ( args [ 0 ] , 'mkdir -p /path/to' ) #NEWLINE# self . assertEqual ( kwargs [ 'user' ] , 'alice' )