diff options
author | Micah Lee <micah@micahflee.com> | 2018-09-30 17:35:58 -0700 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2018-09-30 17:35:58 -0700 |
commit | c572ab996a54d41c26d3e5ce99d5b38ebc406323 (patch) | |
tree | fb1d147a0c21f26a0d5050dcb8bfdba3eadda0f3 /tests | |
parent | 60afaaf338d2c49ffd93a605a90bb645cf37955a (diff) | |
download | onionshare-c572ab996a54d41c26d3e5ce99d5b38ebc406323.tar.gz onionshare-c572ab996a54d41c26d3e5ce99d5b38ebc406323.zip |
Fix tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conftest.py | 7 | ||||
-rw-r--r-- | tests/test_onionshare_strings.py | 12 |
2 files changed, 9 insertions, 10 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 8ac7efb8..3ae6fd52 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,7 +8,7 @@ import tempfile import pytest -from onionshare import common, web, settings +from onionshare import common, web, settings, strings @pytest.fixture def temp_dir_1024(): @@ -151,7 +151,10 @@ def time_strftime(monkeypatch): @pytest.fixture def common_obj(): - return common.Common() + _common = common.Common() + _common.settings = settings.Settings(_common) + strings.load_strings(_common) + return _common @pytest.fixture def settings_obj(sys_onionshare_dev_mode, platform_linux): diff --git a/tests/test_onionshare_strings.py b/tests/test_onionshare_strings.py index d3d40c8f..6d39598c 100644 --- a/tests/test_onionshare_strings.py +++ b/tests/test_onionshare_strings.py @@ -32,12 +32,6 @@ from onionshare import strings # return path # common.get_resource_path = get_resource_path - -def test_starts_with_empty_strings(): - """ Creates an empty strings dict by default """ - assert strings.strings == {} - - def test_underscore_is_function(): assert callable(strings._) and isinstance(strings._, types.FunctionType) @@ -53,11 +47,13 @@ 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 """ - strings.load_strings(common_obj, "fr") + common_obj.settings.set('locale', 'fr') + strings.load_strings(common_obj) assert strings._('preparing_files') == "Préparation des fichiers à partager." def test_load_invalid_locale( self, common_obj, locale_invalid, sys_onionshare_dev_mode): """ load_strings() raises a KeyError for an invalid locale """ with pytest.raises(KeyError): - strings.load_strings(common_obj, 'XX') + common_obj.settings.set('locale', 'XX') + strings.load_strings(common_obj) |