Merge branch 'r4v5-master'

This commit is contained in:
Micah Lee 2014-08-26 16:56:04 -07:00
commit 0f75e0e8d2
2 changed files with 10 additions and 34 deletions

10
.travis.yml Normal file
View 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

View File

@ -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')