Move GUI tests into tests/ dir and fix conftest related stuff so everything loads what it needs and passes

This commit is contained in:
Miguel Jacq 2018-10-13 10:35:09 +11:00
parent 2a00656fd6
commit e3459a5136
31 changed files with 25 additions and 189 deletions

View file

@ -23,7 +23,7 @@ import types
import pytest
from onionshare import strings
from onionshare.settings import Settings
# # Stub get_resource_path so it finds the correct path while running tests
# def get_resource_path(filename):
@ -40,6 +40,7 @@ class TestLoadStrings:
def test_load_strings_defaults_to_english(
self, common_obj, locale_en, sys_onionshare_dev_mode):
""" load_strings() loads English by default """
common_obj.settings = Settings(common_obj)
strings.load_strings(common_obj)
assert strings._('preparing_files') == "Compressing files."
@ -47,6 +48,7 @@ class TestLoadStrings:
def test_load_strings_loads_other_languages(
self, common_obj, locale_fr, sys_onionshare_dev_mode):
""" load_strings() loads other languages in different locales """
common_obj.settings = Settings(common_obj)
common_obj.settings.set('locale', 'fr')
strings.load_strings(common_obj)
assert strings._('preparing_files') == "Préparation des fichiers à partager."
@ -55,5 +57,6 @@ class TestLoadStrings:
self, common_obj, locale_invalid, sys_onionshare_dev_mode):
""" load_strings() raises a KeyError for an invalid locale """
with pytest.raises(KeyError):
common_obj.settings = Settings(common_obj)
common_obj.settings.set('locale', 'XX')
strings.load_strings(common_obj)