Changeset 7808
- Timestamp:
- 06/30/08 08:11:12 (1 year ago)
- Files:
-
- django/trunk/django/contrib/auth/fixtures (copied) (copied from django/trunk/django/contrib/auth/fixtures)
- django/trunk/django/contrib/auth/fixtures/authtestdata.json (copied) (copied from django/trunk/django/contrib/auth/fixtures/authtestdata.json)
- django/trunk/django/contrib/auth/tests.py (modified) (2 diffs)
- django/trunk/django/contrib/auth/urls.py (copied) (copied from django/trunk/django/contrib/auth/urls.py) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/auth/tests.py
r7726 r7808 1 1 """ 2 >>> from models import User, AnonymousUser2 >>> from django.contrib.auth.models import User, AnonymousUser 3 3 >>> u = User.objects.create_user('testuser', 'test@example.com', 'testpw') 4 4 >>> u.has_usable_password() … … 54 54 u'!' 55 55 """ 56 57 from django.test import TestCase 58 from django.core import mail 59 60 class PasswordResetTest(TestCase): 61 fixtures = ['authtestdata.json'] 62 urls = 'django.contrib.auth.urls' 63 def test_email_not_found(self): 64 "Error is raised if the provided email address isn't currently registered" 65 response = self.client.get('/password_reset/') 66 self.assertEquals(response.status_code, 200) 67 response = self.client.post('/password_reset/', {'email': 'not_a_real_email@email.com'}) 68 self.assertContains(response, "That e-mail address doesn't have an associated user account") 69 self.assertEquals(len(mail.outbox), 0) 70 71 def test_email_found(self): 72 "Email is sent if a valid email address is provided for password reset" 73 response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'}) 74 self.assertEquals(response.status_code, 302) 75 self.assertEquals(len(mail.outbox), 1) django/trunk/django/contrib/auth/urls.py
r7716 r7808 1 # This exists for the sake of testing only. Normally URLs are mapped in 2 # ../admin/urls.py 1 # These URLs are normally mapped to /admin/urls.py. This URLs file is 2 # provided as a convenience to those who want to deploy these URLs elsewhere. 3 # This file is also used to provide a reliable view deployment for test purposes. 3 4 4 5 from django.conf.urls.defaults import *
