tests: exercise non-ASCII login information.

(imported from commit 51a79a637a2d624c78627c84cd93d10cd700dff5)
This commit is contained in:
Jessica McKellar 2013-03-20 17:08:48 -04:00
parent 7f3e8923a8
commit 531ad235df
1 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.simple import DjangoTestSuiteRunner
@ -217,6 +219,24 @@ class LoginTest(AuthedTestCase):
self.client.post('/accounts/logout/')
self.assertIsNone(self.client.session.get('_auth_user_id', None))
def test_non_ascii_login(self):
"""
You can log in even if your password contain non-ASCII characters.
"""
email = "test@humbughq.com"
password = u"hümbüǵ"
# Registering succeeds.
self.register("test", password)
user = User.objects.get(email=email)
self.assertEqual(self.client.session['_auth_user_id'], user.id)
self.client.post('/accounts/logout/')
self.assertIsNone(self.client.session.get('_auth_user_id', None))
# Logging in succeeds.
self.client.post('/accounts/logout/')
self.login(email, password)
self.assertEqual(self.client.session['_auth_user_id'], user.id)
class PersonalMessagesTest(AuthedTestCase):
fixtures = ['messages.json']