mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-05 16:05:24 -04:00
Renamed onionshare.helpers module to onionshare.common
This commit is contained in:
parent
219c4351e1
commit
1591888863
19 changed files with 74 additions and 75 deletions
|
@ -18,14 +18,14 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import locale, os
|
||||
from onionshare import helpers, strings
|
||||
from onionshare import common, strings
|
||||
|
||||
# Stub get_resource_path so it finds the correct path while running tests
|
||||
def get_resource_path(filename):
|
||||
resources_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'share')
|
||||
path = os.path.join(resources_dir, filename)
|
||||
return path
|
||||
helpers.get_resource_path = get_resource_path
|
||||
common.get_resource_path = get_resource_path
|
||||
|
||||
def test_starts_with_empty_strings():
|
||||
"""creates an empty strings dict by default"""
|
||||
|
@ -35,12 +35,12 @@ def test_starts_with_empty_strings():
|
|||
def test_load_strings_defaults_to_english():
|
||||
"""load_strings() loads English by default"""
|
||||
locale.getdefaultlocale = lambda: ('en_US', 'UTF-8')
|
||||
strings.load_strings(helpers)
|
||||
strings.load_strings(common)
|
||||
assert strings._('wait_for_hs') == "Waiting for HS to be ready:"
|
||||
|
||||
|
||||
def test_load_strings_loads_other_languages():
|
||||
"""load_strings() loads other languages in different locales"""
|
||||
locale.getdefaultlocale = lambda: ('fr_FR', 'UTF-8')
|
||||
strings.load_strings(helpers, "fr")
|
||||
strings.load_strings(common, "fr")
|
||||
assert strings._('wait_for_hs') == "En attente du HS:"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue