Add another test.

This commit is contained in:
Brian May 2015-12-15 14:23:42 +11:00
parent 3db38c992a
commit ba60d22478

View File

@ -11,6 +11,7 @@ import sshuttle.helpers
@patch('sshuttle.helpers.sys.stderr') @patch('sshuttle.helpers.sys.stderr')
def test_log(mock_stderr, mock_stdout): def test_log(mock_stderr, mock_stdout):
sshuttle.helpers.log("message") sshuttle.helpers.log("message")
sshuttle.helpers.log("abc")
sshuttle.helpers.log("message 1\n") sshuttle.helpers.log("message 1\n")
sshuttle.helpers.log("message 2\nline2\nline3\n") sshuttle.helpers.log("message 2\nline2\nline3\n")
sshuttle.helpers.log("message 3\nline2\nline3") sshuttle.helpers.log("message 3\nline2\nline3")
@ -19,10 +20,13 @@ def test_log(mock_stderr, mock_stdout):
call.flush(), call.flush(),
call.flush(), call.flush(),
call.flush(), call.flush(),
call.flush(),
] ]
assert mock_stderr.mock_calls == [ assert mock_stderr.mock_calls == [
call.write('prefix: message'), call.write('prefix: message'),
call.flush(), call.flush(),
call.write('prefix: abc'),
call.flush(),
call.write('prefix: message 1\n'), call.write('prefix: message 1\n'),
call.flush(), call.flush(),
call.write('prefix: message 2\n'), call.write('prefix: message 2\n'),