mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Merge branch 'r4v5-master'
This commit is contained in:
commit
0f75e0e8d2
10
.travis.yml
Normal file
10
.travis.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "2.6"
|
||||||
|
- "2.7"
|
||||||
|
# command to install dependencies
|
||||||
|
before_install: "sudo apt-get install -y build-essential fakeroot python-all python-stdeb python-flask python-qt4"
|
||||||
|
install: "pip install nose flask stem"
|
||||||
|
# command to run tests
|
||||||
|
script: nosetests test
|
||||||
|
|
@ -21,40 +21,6 @@ class MockSubprocess():
|
|||||||
def last_call_args(self):
|
def last_call_args(self):
|
||||||
return self.last_call
|
return self.last_call
|
||||||
|
|
||||||
def test_tails_open_port():
|
|
||||||
"tails_open_port() calls iptables with ACCEPT arg"
|
|
||||||
onionshare.get_platform = lambda: 'Tails'
|
|
||||||
onionshare.strings = {'punching_a_hole': ''}
|
|
||||||
|
|
||||||
mock_subprocess = MockSubprocess()
|
|
||||||
onionshare.subprocess = mock_subprocess
|
|
||||||
onionshare.tails_open_port('port')
|
|
||||||
|
|
||||||
expected_call = [
|
|
||||||
'/sbin/iptables', '-I', 'OUTPUT',
|
|
||||||
'-o', 'lo', '-p',
|
|
||||||
'tcp', '--dport', 'port', '-j', 'ACCEPT'
|
|
||||||
]
|
|
||||||
actual_call = mock_subprocess.last_call_args()
|
|
||||||
assert actual_call == expected_call
|
|
||||||
|
|
||||||
def test_tails_close_port():
|
|
||||||
"tails_close_port() calls iptables with REJECT arg"
|
|
||||||
onionshare.get_platform = lambda: 'Tails'
|
|
||||||
onionshare.strings = {'closing_hole': ''}
|
|
||||||
|
|
||||||
mock_subprocess = MockSubprocess()
|
|
||||||
onionshare.subprocess = mock_subprocess
|
|
||||||
onionshare.tails_close_port('port')
|
|
||||||
|
|
||||||
expected_call = [
|
|
||||||
'/sbin/iptables', '-I', 'OUTPUT',
|
|
||||||
'-o', 'lo', '-p',
|
|
||||||
'tcp', '--dport', 'port', '-j', 'REJECT'
|
|
||||||
]
|
|
||||||
actual_call = mock_subprocess.last_call_args()
|
|
||||||
assert actual_call == expected_call
|
|
||||||
|
|
||||||
def test_load_strings_defaults_to_english():
|
def test_load_strings_defaults_to_english():
|
||||||
"load_strings() loads English by default"
|
"load_strings() loads English by default"
|
||||||
locale.getdefaultlocale = lambda: ('en_US', 'UTF-8')
|
locale.getdefaultlocale = lambda: ('en_US', 'UTF-8')
|
||||||
|
Loading…
Reference in New Issue
Block a user