Opened 12 years ago

Last modified 12 years ago

#17980 closed Bug

Tests fail when i18n set to True. — at Initial Version

Reported by: wassup Owned by: nobody
Component: contrib.auth Version: 1.4
Severity: Normal Keywords: tests
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

When i18n is set to True and project language is not English, some of the default django tests do not pass (it worked fine in 1.3). I believe the reason is that the messages get translated and localized before the tests are run, which results in e.g.:

======================================================================
FAIL: test_unusable_password (django.contrib.auth.tests.forms.PasswordResetFormTest)


Traceback (most recent call last):

File "/usr/lib/python2.7/site-packages/django/contrib/auth/tests/forms.py", line 336, in test_unusable_password

[u"The user account associated with this e-mail address cannot reset the password."])

AssertionError: [u'U\u017cytkownik, kt\xf3rego konto powi\u0105zane jest z tym adresem e-mail nie mo\u017ce zresetowa\u0107 has\u0142a.'] != [u'The user account associated with this e-mail address cannot reset the password.']

======================================================================
FAIL: test_confirm_different_passwords (django.contrib.auth.tests.views.PasswordResetTest)


Traceback (most recent call last):

File "/usr/lib/python2.7/site-packages/django/contrib/auth/tests/views.py", line 184, in test_confirm_different_passwords

self.assertContainsEscaped(response, SetPasswordForm.error_messagespassword_mismatch)

File "/usr/lib/python2.7/site-packages/django/contrib/auth/tests/views.py", line 54, in assertContainsEscaped

return self.assertContains(response, escape(force_unicode(text)), kwargs)

File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 637, in assertContains

msg_prefix + "Couldn't find '%s' in response" % text)

AssertionError: Couldn't find 'Hasła się nie zgadzają.' in response

======================================================================
FAIL: test_email_not_found (django.contrib.auth.tests.views.PasswordResetTest)
Error is raised if the provided email address isn't currently registered


Traceback (most recent call last):

File "/usr/lib/python2.7/site-packages/django/contrib/auth/tests/views.py", line 91, in test_email_not_found

self.assertContainsEscaped(response, PasswordResetForm.error_messagesunknown)

File "/usr/lib/python2.7/site-packages/django/contrib/auth/tests/views.py", line 54, in assertContainsEscaped

return self.assertContains(response, escape(force_unicode(text)), kwargs)

File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 637, in assertContains

msg_prefix + "Couldn't find '%s' in response" % text)

AssertionError: Couldn't find 'Ten adres e-mail nie ma przypisanego konta. Jesteś pewien, że zarejestrowałeś się?' in response


I believe the default django tests should not be run against the localized strings or am I missing something?

Regards,

wassup

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top