@@ -19,12 +19,20 @@ def __init__(self):
19
19
self .private_key_file = None
20
20
self .check = False
21
21
22
- def _execute_module (self , conn , tmp , module_name , args , inject = None ):
22
+ def _execute_module (self , conn , tmp , module_name , args ,
23
+ async_jid = None , async_module = None , async_limit = None , inject = None ,
24
+ persist_files = False , complex_args = None , delete_remote_tmp = True ):
23
25
self .executed_conn = conn
24
26
self .executed_tmp = tmp
25
27
self .executed_module_name = module_name
26
28
self .executed_args = args
29
+ self .executed_async_jid = async_jid
30
+ self .executed_async_module = async_module
31
+ self .executed_async_limit = async_limit
27
32
self .executed_inject = inject
33
+ self .executed_persist_files = persist_files
34
+ self .executed_complex_args = complex_args
35
+ self .executed_delete_remote_tmp = delete_remote_tmp
28
36
29
37
def noop_on_check (self , inject ):
30
38
return self .check
@@ -60,7 +68,7 @@ def test_synchronize_action_basic(self):
60
68
x .run (conn , "/tmp" , "synchronize" , "src=/tmp/foo dest=/tmp/bar" , inject )
61
69
62
70
assert runner .executed_inject ['delegate_to' ] == "127.0.0.1" , "was not delegated to 127.0.0.1"
63
- assert runner .
executed_args == "dest= [email protected] :/tmp/bar src= /tmp/foo" ,
"wrong args used"
71
+ assert runner .
executed_complex_args == { "dest" : " [email protected] :/tmp/bar" , " src" : " /tmp/foo"} ,
"wrong args used"
64
72
assert runner .sudo == None , "sudo was not reset to None"
65
73
66
74
def test_synchronize_action_sudo (self ):
@@ -86,8 +94,9 @@ def test_synchronize_action_sudo(self):
86
94
x .run (conn , "/tmp" , "synchronize" , "src=/tmp/foo dest=/tmp/bar" , inject )
87
95
88
96
assert runner .executed_inject ['delegate_to' ] == "127.0.0.1" , "was not delegated to 127.0.0.1"
89
- assert runner .
executed_args == '[email protected] :/tmp/bar src=/tmp/foo rsync_path="sudo rsync"' , \
90
- "wrong args used: %s" % runner .executed_args
97
+ assert runner .
executed_complex_args == {
'dest' :
'[email protected] :/tmp/bar' ,
98
+ 'src' :'/tmp/foo' ,
99
+ 'rsync_path' :'"sudo rsync"' }, "wrong args used"
91
100
assert runner .sudo == True , "sudo was not reset to True"
92
101
93
102
@@ -117,9 +126,9 @@ def test_synchronize_action_local(self):
117
126
assert runner .transport == "paramiko" , "runner transport was changed"
118
127
assert runner .remote_user == "jtanner" , "runner remote_user was changed"
119
128
assert runner .executed_inject ['delegate_to' ] == "127.0.0.1" , "was not delegated to 127.0.0.1"
120
- assert "dest_port" not in runner .executed_args , "dest_port should not have been set"
121
- assert "src= /tmp/foo" in runner . executed_args , "source was set incorrectly"
122
- assert "dest= /tmp/bar" in runner . executed_args , "dest was set incorrectly"
129
+ assert "dest_port" not in runner .executed_complex_args , "dest_port should not have been set"
130
+ assert runner . executed_complex_args . get ( "src" ) == " /tmp/foo" , "source was set incorrectly"
131
+ assert runner . executed_complex_args . get ( "dest" ) == " /tmp/bar" , "dest was set incorrectly"
123
132
124
133
125
134
def test_synchronize_action_vagrant (self ):
@@ -158,7 +167,7 @@ def test_synchronize_action_vagrant(self):
158
167
assert runner .remote_user == "jtanner" , "runner remote_user was changed"
159
168
assert runner .executed_inject ['delegate_to' ] == "127.0.0.1" , "was not delegated to 127.0.0.1"
160
169
assert runner .executed_inject ['ansible_ssh_user' ] == "vagrant" , "runner user was changed"
161
- assert "dest_port=2222" in runner . executed_args , "remote port was not set to 2222"
162
- assert "src= /tmp/foo" in runner . executed_args , "source was set incorrectly"
163
- assert "dest= [email protected] :/tmp/bar" in runner . executed_args ,
"dest was set incorrectly"
170
+ assert runner . executed_complex_args . get ( "dest_port" ) == "2222" , "remote port was not set to 2222"
171
+ assert runner . executed_complex_args . get ( "src" ) == " /tmp/foo" , "source was set incorrectly"
172
+ assert runner . executed_complex_args . get ( "dest" ) == " [email protected] :/tmp/bar",
"dest was set incorrectly"
164
173
0 commit comments