mirror of
https://github.com/sshuttle/sshuttle.git
synced 2024-11-21 23:43:18 +01:00
Fix flake8 and unit test errors introduced by use_pty fixes.
This commit is contained in:
parent
8e826cfa7d
commit
80a822e079
@ -15,6 +15,7 @@ from sshuttle.methods import get_auto_method, get_method
|
|||||||
HOSTSFILE = '/etc/hosts'
|
HOSTSFILE = '/etc/hosts'
|
||||||
sshuttle_pid = None
|
sshuttle_pid = None
|
||||||
|
|
||||||
|
|
||||||
def rewrite_etc_hosts(hostmap, port):
|
def rewrite_etc_hosts(hostmap, port):
|
||||||
BAKFILE = '%s.sbak' % HOSTSFILE
|
BAKFILE = '%s.sbak' % HOSTSFILE
|
||||||
APPEND = '# sshuttle-firewall-%d AUTOCREATED' % port
|
APPEND = '# sshuttle-firewall-%d AUTOCREATED' % port
|
||||||
@ -55,6 +56,7 @@ def restore_etc_hosts(hostmap, port):
|
|||||||
debug2('undoing /etc/hosts changes.')
|
debug2('undoing /etc/hosts changes.')
|
||||||
rewrite_etc_hosts({}, port)
|
rewrite_etc_hosts({}, port)
|
||||||
|
|
||||||
|
|
||||||
def firewall_exit(signum, frame):
|
def firewall_exit(signum, frame):
|
||||||
# The typical sshuttle exit is that the main sshuttle process
|
# The typical sshuttle exit is that the main sshuttle process
|
||||||
# exits, closes file descriptors it uses, and the firewall process
|
# exits, closes file descriptors it uses, and the firewall process
|
||||||
|
@ -15,7 +15,7 @@ NSLIST
|
|||||||
{inet},1.2.3.33
|
{inet},1.2.3.33
|
||||||
{inet6},2404:6800:4004:80c::33
|
{inet6},2404:6800:4004:80c::33
|
||||||
PORTS 1024,1025,1026,1027
|
PORTS 1024,1025,1026,1027
|
||||||
GO 1 - 0x01
|
GO 1 - 0x01 12345
|
||||||
HOST 1.2.3.3,existing
|
HOST 1.2.3.3,existing
|
||||||
""".format(inet=AF_INET, inet6=AF_INET6))
|
""".format(inet=AF_INET, inet6=AF_INET6))
|
||||||
stdout = Mock()
|
stdout = Mock()
|
||||||
|
@ -24,19 +24,19 @@ def test_log(mock_stderr, mock_stdout):
|
|||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
assert mock_stderr.mock_calls == [
|
assert mock_stderr.mock_calls == [
|
||||||
call.write('prefix: message\n'),
|
call.write('prefix: message\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
call.write('prefix: abc\n'),
|
call.write('prefix: abc\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
call.write('prefix: message 1\n'),
|
call.write('prefix: message 1\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
call.write('prefix: message 2\n'),
|
call.write('prefix: message 2\r\n'),
|
||||||
call.write(' line2\n'),
|
call.write(' line2\r\n'),
|
||||||
call.write(' line3\n'),
|
call.write(' line3\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
call.write('prefix: message 3\n'),
|
call.write('prefix: message 3\r\n'),
|
||||||
call.write(' line2\n'),
|
call.write(' line2\r\n'),
|
||||||
call.write(' line3\n'),
|
call.write(' line3\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ def test_debug1(mock_stderr, mock_stdout):
|
|||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
assert mock_stderr.mock_calls == [
|
assert mock_stderr.mock_calls == [
|
||||||
call.write('prefix: message\n'),
|
call.write('prefix: message\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ def test_debug2(mock_stderr, mock_stdout):
|
|||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
assert mock_stderr.mock_calls == [
|
assert mock_stderr.mock_calls == [
|
||||||
call.write('prefix: message\n'),
|
call.write('prefix: message\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ def test_debug3(mock_stderr, mock_stdout):
|
|||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
assert mock_stderr.mock_calls == [
|
assert mock_stderr.mock_calls == [
|
||||||
call.write('prefix: message\n'),
|
call.write('prefix: message\r\n'),
|
||||||
call.flush(),
|
call.flush(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user