Skip to content

Commit

Permalink
Merge pull request #1641 from mstriemer/unicode-in-lazy-translations
Browse files Browse the repository at this point in the history
Use unicode strings in FxA login error translations
  • Loading branch information
mstriemer committed Feb 9, 2016
2 parents 9d03433 + 14563a7 commit 9429aa0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/olympia/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
}
LOGIN_ERROR_MESSAGES = {
ERROR_NO_CODE:
_('Your log in attempt could not be parsed. Please try again.'),
_(u'Your log in attempt could not be parsed. Please try again.'),
ERROR_NO_PROFILE:
_('Your Firefox Account could not be found. Please try again.'),
ERROR_STATE_MISMATCH: _('You could not be logged in. Please try again.'),
_(u'Your Firefox Account could not be found. Please try again.'),
ERROR_STATE_MISMATCH: _(u'You could not be logged in. Please try again.'),
ERROR_USER_MIGRATED:
_('Your account has already been migrated to Firefox Accounts.'),
_(u'Your account has already been migrated to Firefox Accounts.'),
ERROR_USER_MISMATCH:
_('Your Firefox Account already exists on this site.'),
_(u'Your Firefox Account already exists on this site.'),
}


Expand Down
8 changes: 7 additions & 1 deletion src/olympia/users/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

from olympia import amo
from olympia.amo.tests import TestCase
from olympia.users import notifications as email
from olympia.abuse.models import AbuseReport
from olympia.access.models import Group, GroupUser
from olympia.accounts.views import ERROR_NO_CODE
from olympia.addons.models import Addon, AddonUser, Category
from olympia.amo.helpers import urlparams
from olympia.amo.pyquery_wrapper import PyQuery as pq
from olympia.amo.urlresolvers import reverse
from olympia.bandwagon.models import Collection, CollectionWatcher
from olympia.devhub.models import ActivityLog
from olympia.reviews.models import Review
from olympia.users import notifications as email
from olympia.users.models import (
BlacklistedPassword, UserProfile, UserNotification)
from olympia.users.utils import EmailResetCode, UnsubscribeCode
Expand Down Expand Up @@ -620,6 +621,11 @@ def test_login_ajax_wrong(self):
text = 'Please enter a correct username and password.'
assert res.context['form'].errors['__all__'][0].startswith(text)

def test_login_fxa_error(self):
response = self.client.get(urlparams(self.url, error=ERROR_NO_CODE))
assert response.status_code == 200
assert 'could not be parsed' in response.content

def test_login_no_recaptcha(self):
res = self.client.post(self.url, data=self.data)
eq_(res.status_code, 302)
Expand Down

0 comments on commit 9429aa0

Please sign in to comment.