File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
openwisp_controller/connection/tests Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1
1
import socket
2
2
from unittest import mock
3
+ from unittest .mock import PropertyMock
3
4
4
5
import paramiko
5
6
from django .contrib .auth .models import ContentType
@@ -46,7 +47,7 @@ def _exec_command_return_value(
46
47
stderr_ = mock .Mock ()
47
48
stdin_ .read ().decode .return_value = stdin
48
49
stdout_ .read ().decode .return_value = stdout
49
- stdout_ .channel .exit_status = exit_code
50
+ type( stdout_ .channel ) .exit_status = PropertyMock ( return_value = exit_code )
50
51
stderr_ .read ().decode .return_value = stderr
51
52
return (stdin_ , stdout_ , stderr_ )
52
53
@@ -1009,7 +1010,7 @@ def _assert_applying_conf_test_command(mocked_exec):
1009
1010
# 1. Checking openwisp_config returns with 0
1010
1011
# 2. Testing presence of /tmp/openwisp/applying_conf returns with 1
1011
1012
# 3. Restarting openwisp_config returns with 0 exit code
1012
- stdout .channel . recv_exit_status . side_effect = [0 , 1 , 1 ]
1013
+ type( stdout .channel ). exit_status = PropertyMock ( side_effect = [0 , 1 , 1 ])
1013
1014
mocked_exec_command .return_value = (stdin , stdout , stderr )
1014
1015
conf .save ()
1015
1016
self .assertEqual (mocked_exec_command .call_count , 3 )
You can’t perform that action at this time.
0 commit comments