Skip to content

Commit

Permalink
patch upref_mdata 2
Browse files Browse the repository at this point in the history
  • Loading branch information
n00rsy committed Apr 19, 2024
1 parent 07b4986 commit 7094642
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test_user_pref_sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,18 @@ def test_get_user_preferences_cn(self, upref_mdata, get_country_code_by_country)
assert 'us' in prefs and 'united states' in prefs

@with_context
def test_get_user_preferences_invalid(self):
@patch('pybossa.cache.users.app_settings.upref_mdata.get_country_code_by_country')
@patch('pybossa.cache.users.app_settings.upref_mdata')
def test_get_user_preferences_invalid(self, upref_mdata, get_country_code_by_country):
"""
Test invalid location preference
"""
user = UserFactory.create()
user.user_pref = {'locations': ['invalid country']}
user_repo.save(user)

get_country_code_by_country.return_value = None

prefs = get_user_preferences(user.id, map_to_country_codes=True)

assert 'invalid country' in prefs
Expand Down

0 comments on commit 7094642

Please sign in to comment.