@ -42,6 +42,10 @@ with open('task_vars.json', 'wb') as f:
'''
'''
class BreakPoint ( Exception ) :
pass
class TaskMock ( object ) :
class TaskMock ( object ) :
args = { ' src ' : u ' /tmp/deleteme ' ,
args = { ' src ' : u ' /tmp/deleteme ' ,
' dest ' : ' /tmp/deleteme ' ,
' dest ' : ' /tmp/deleteme ' ,
@ -246,3 +250,15 @@ class TestSynchronizeAction(unittest.TestCase):
# delegate to other remote host with su enabled
# delegate to other remote host with su enabled
x = SynchronizeTester ( )
x = SynchronizeTester ( )
x . runtest ( fixturepath = os . path . join ( self . fixturedir , ' delegate_remote_su ' ) )
x . runtest ( fixturepath = os . path . join ( self . fixturedir , ' delegate_remote_su ' ) )
@patch.object ( ActionModule , ' _low_level_execute_command ' , side_effect = BreakPoint )
@patch.object ( ActionModule , ' _remote_expand_user ' , side_effect = ActionModule . _remote_expand_user , autospec = True )
def test_remote_user_not_in_local_tmpdir ( self , spy_remote_expand_user , ll_ec ) :
x = SynchronizeTester ( )
SAM = ActionModule ( x . task , x . connection , x . _play_context ,
x . loader , x . templar , x . shared_loader_obj )
try :
SAM . run ( task_vars = { ' hostvars ' : { ' foo ' : { } , ' localhost ' : { } } , ' inventory_hostname ' : ' foo ' } )
except BreakPoint :
pass
self . assertEqual ( spy_remote_expand_user . call_count , 0 )