mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-10 21:18:36 +01:00
Use readline instead of next.
This commit is contained in:
parent
71d17e449e
commit
641a193d3d
@ -41,22 +41,22 @@ def test_rewrite_etc_hosts():
|
|||||||
}
|
}
|
||||||
sshuttle.firewall.rewrite_etc_hosts(10)
|
sshuttle.firewall.rewrite_etc_hosts(10)
|
||||||
with open("tmp/hosts") as f:
|
with open("tmp/hosts") as f:
|
||||||
line = f.next()
|
line = f.readline()
|
||||||
s = line.split()
|
s = line.split()
|
||||||
assert s == ['1.2.3.3', 'existing']
|
assert s == ['1.2.3.3', 'existing']
|
||||||
|
|
||||||
line = f.next()
|
line = f.readline()
|
||||||
s = line.split()
|
s = line.split()
|
||||||
assert s == ['1.2.3.4', 'myhost',
|
assert s == ['1.2.3.4', 'myhost',
|
||||||
'#', 'sshuttle-firewall-10', 'AUTOCREATED']
|
'#', 'sshuttle-firewall-10', 'AUTOCREATED']
|
||||||
|
|
||||||
line = f.next()
|
line = f.readline()
|
||||||
s = line.split()
|
s = line.split()
|
||||||
assert s == ['1.2.3.5', 'myotherhost',
|
assert s == ['1.2.3.5', 'myotherhost',
|
||||||
'#', 'sshuttle-firewall-10', 'AUTOCREATED']
|
'#', 'sshuttle-firewall-10', 'AUTOCREATED']
|
||||||
|
|
||||||
with pytest.raises(StopIteration):
|
line = f.readline()
|
||||||
line = f.next()
|
assert line == ""
|
||||||
|
|
||||||
sshuttle.firewall.restore_etc_hosts(10)
|
sshuttle.firewall.restore_etc_hosts(10)
|
||||||
assert filecmp.cmp("tmp/hosts.orig", "tmp/hosts", shallow=False) is True
|
assert filecmp.cmp("tmp/hosts.orig", "tmp/hosts", shallow=False) is True
|
||||||
|
Loading…
Reference in New Issue
Block a user