forked from GithubBackups/healthchecks
Add test for case insensitive email addresses.
This commit is contained in:
parent
b191b968f3
commit
157bd74aeb
@ -2,6 +2,7 @@ from django.contrib.auth.models import User
|
|||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
from hc.accounts.models import Profile
|
||||||
from hc.api.models import Check
|
from hc.api.models import Check
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
@ -66,3 +67,18 @@ class LoginTestCase(TestCase):
|
|||||||
r = self.client.post("/accounts/login/", form)
|
r = self.client.post("/accounts/login/", form)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
self.assertContains(r, "Incorrect email")
|
self.assertContains(r, "Incorrect email")
|
||||||
|
|
||||||
|
def test_it_ignores_ces(self):
|
||||||
|
alice = User(username="alice", email="alice@example.org")
|
||||||
|
alice.save()
|
||||||
|
|
||||||
|
form = {"email": "ALICE@EXAMPLE.ORG"}
|
||||||
|
|
||||||
|
r = self.client.post("/accounts/login/", form)
|
||||||
|
assert r.status_code == 302
|
||||||
|
|
||||||
|
# There should be exactly one user:
|
||||||
|
self.assertEqual(User.objects.count(), 1)
|
||||||
|
|
||||||
|
profile = Profile.objects.for_user(alice)
|
||||||
|
self.assertIn("login", profile.token)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user