Merge branch 'master' of github.com:micahflee/onionshare

This commit is contained in:
Micah Lee 2014-06-10 23:27:37 +00:00
commit fe92255dfa

View File

@ -1,24 +1,16 @@
from onionshare import *
import tempfile
def test_get_platform_returns_env_var():
"get_platform() returns ONIONSHARE_PLATFORM from the environment"
os.environ['ONIONSHARE_PLATFORM'] = 'TI-83+'
assert get_platform() == 'TI-83+'
def test_get_platform_on_tails():
"get_platform() returns 'Tails' when hostname is 'amnesia'"
onionshare.platform.uname = lambda: ('Linux', 'amnesia', '3.14-1-amd64', '#1 SMP Debian 3.14.4-1 (2014-05-13)', 'x86_64', '')
assert get_platform() == 'Tails'
def test_get_platform_returns_platform_system():
"get_platform() returns platform.system() when ONIONSHARE_PLATFORM is not defined"
os.environ.pop('ONIONSHARE_PLATFORM', None)
onionshare.platform.system = lambda: 'Sega Saturn'
assert get_platform() == 'Sega Saturn'
def test_tails_appends_to_path():
"adds '/../tails/lib' to the path when running on Tails"
original_path = sys.path
onionshare.platform.system = lambda: 'Tails'
append_lib_on_tails()
assert sys.path[-1][-13:] == '/../tails/lib'
def test_get_hidden_service_dir_windows_with_temp():
"get_hidden_service_dir() uses a directory from the Windows environment when defined"
onionshare.platform.system = lambda: 'Windows'