MCPcopy
hub / github.com/sshuttle/sshuttle / test_log

Function test_log

tests/client/test_helpers.py:13–41  ·  view source on GitHub ↗
(mock_stderr, mock_stdout)

Source from the content-addressed store, hash-verified

11@patch('sshuttle.helpers.sys.stdout')
12@patch('sshuttle.helpers.sys.stderr')
13def test_log(mock_stderr, mock_stdout):
14 sshuttle.helpers.log("message")
15 sshuttle.helpers.log("abc")
16 sshuttle.helpers.log("message 1\n")
17 sshuttle.helpers.log("message 2\nline2\nline3\n")
18 sshuttle.helpers.log("message 3\nline2\nline3")
19 assert mock_stdout.mock_calls == [
20 call.flush(),
21 call.flush(),
22 call.flush(),
23 call.flush(),
24 call.flush(),
25 ]
26 assert mock_stderr.mock_calls == [
27 call.write('prefix: message\n'),
28 call.flush(),
29 call.write('prefix: abc\n'),
30 call.flush(),
31 call.write('prefix: message 1\n'),
32 call.flush(),
33 call.write('prefix: message 2\n'),
34 call.write(' line2\n'),
35 call.write(' line3\n'),
36 call.flush(),
37 call.write('prefix: message 3\n'),
38 call.write(' line2\n'),
39 call.write(' line3\n'),
40 call.flush(),
41 ]
42
43
44@patch('sshuttle.helpers.logprefix', new='prefix: ')

Callers

nothing calls this directly

Calls 2

flushMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected