Renamed onionshare.helpers module to onionshare.common

This commit is contained in:
Micah Lee 2017-05-16 11:05:48 -07:00
parent 219c4351e1
commit 1591888863
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
19 changed files with 74 additions and 75 deletions

View file

@ -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:"