Opened 17 years ago
Closed 17 years ago
#7756 closed (duplicate)
contrib.auth dependency on contrib.admin
| Reported by: | nail.xx | Owned by: | |
|---|---|---|---|
| Component: | contrib.auth | Version: | dev |
| Severity: | Keywords: | admin dependency test | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Commit #7808 introduced contrib.auth dependency on contrib.admin. It appears if you included django.contrib.auth in INSTALLED_APPS and didn't include django.contrib.admin. If you will try to run tests (manage.py test), you will see 2 test errors:
======================================================================
ERROR: Email is sent if a valid email address is provided for password reset
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Python\django-trunk\django\contrib\auth\tests.py", line 73, in test_email_found
response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
File "D:\Python\django-trunk\django\test\client.py", line 286, in post
return self.request(**r)
File "D:\Python\django-trunk\django\core\handlers\base.py", line 86, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "D:\Python\django-trunk\django\contrib\auth\views.py", line 80, in password_reset
form.save(email_template_name=email_template_name)
File "D:\Python\django-trunk\django\contrib\auth\forms.py", line 99, in save
t = loader.get_template(email_template_name)
File "D:\Python\django-trunk\django\template\loader.py", line 80, in get_template
source, origin = find_template_source(template_name)
File "D:\Python\django-trunk\django\template\loader.py", line 73, in find_template_source
raise TemplateDoesNotExist, name
TemplateDoesNotExist: registration/password_reset_email.html
======================================================================
ERROR: Error is raised if the provided email address isn't currently registered
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Python\django-trunk\django\contrib\auth\tests.py", line 65, in test_email_not_found
response = self.client.get('/password_reset/')
File "D:\Python\django-trunk\django\test\client.py", line 266, in get
return self.request(**r)
File "D:\Python\django-trunk\django\core\handlers\base.py", line 86, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "D:\Python\django-trunk\django\contrib\auth\views.py", line 85, in password_reset
context_instance=RequestContext(request))
File "D:\Python\django-trunk\django\shortcuts\__init__.py", line 18, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "D:\Python\django-trunk\django\template\loader.py", line 102, in render_to_string
t = get_template(template_name)
File "D:\Python\django-trunk\django\template\loader.py", line 80, in get_template
source, origin = find_template_source(template_name)
File "D:\Python\django-trunk\django\template\loader.py", line 73, in find_template_source
raise TemplateDoesNotExist, name
TemplateDoesNotExist: registration/password_reset_form.html
This is because default test templates are in contrib.admin application and the test is in contrib.auth.
If this is expected dependency it should be declared in documentation (http://www.djangoproject.com/documentation/authentication/). Or dependency should be removed by using separate URL set and separate templates for that tests.
duplicate of #7611.