mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-06 08:25:15 -04:00
Fix tests after refactoring Common
This commit is contained in:
parent
50409167d4
commit
c2fecf8aa4
7 changed files with 73 additions and 79 deletions
|
@ -22,7 +22,7 @@ import types
|
|||
|
||||
import pytest
|
||||
|
||||
from onionshare import common, strings
|
||||
from onionshare import strings
|
||||
|
||||
|
||||
# # Stub get_resource_path so it finds the correct path while running tests
|
||||
|
@ -44,28 +44,28 @@ def test_underscore_is_function():
|
|||
|
||||
class TestLoadStrings:
|
||||
def test_load_strings_defaults_to_english(
|
||||
self, locale_en, sys_onionshare_dev_mode):
|
||||
self, common_obj, locale_en, sys_onionshare_dev_mode):
|
||||
""" load_strings() loads English by default """
|
||||
strings.load_strings(common)
|
||||
strings.load_strings(common_obj)
|
||||
assert strings._('wait_for_hs') == "Waiting for HS to be ready:"
|
||||
|
||||
|
||||
def test_load_strings_loads_other_languages(
|
||||
self, locale_fr, sys_onionshare_dev_mode):
|
||||
self, common_obj, locale_fr, sys_onionshare_dev_mode):
|
||||
""" load_strings() loads other languages in different locales """
|
||||
strings.load_strings(common, "fr")
|
||||
strings.load_strings(common_obj, "fr")
|
||||
assert strings._('wait_for_hs') == "En attente du HS:"
|
||||
|
||||
def test_load_partial_strings(
|
||||
self, locale_ru, sys_onionshare_dev_mode):
|
||||
strings.load_strings(common)
|
||||
self, common_obj, locale_ru, sys_onionshare_dev_mode):
|
||||
strings.load_strings(common_obj)
|
||||
assert strings._("give_this_url") == (
|
||||
"Отправьте эту ссылку тому человеку, "
|
||||
"которому вы хотите передать файл:")
|
||||
assert strings._('wait_for_hs') == "Waiting for HS to be ready:"
|
||||
|
||||
def test_load_invalid_locale(
|
||||
self, locale_invalid, sys_onionshare_dev_mode):
|
||||
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, 'XX')
|
||||
strings.load_strings(common_obj, 'XX')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue