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