1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #7758 and #17189 -- Allowed to override the form_url context var in the admin change view and the user admin's password change view. Thanks, michal and krzysztof.szczesny.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17466 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel
2012-02-09 18:56:32 +00:00
parent 03eeb020a0
commit b46d90c63a
4 changed files with 31 additions and 3 deletions

View File

@@ -574,6 +574,25 @@ class AdminViewBasicTest(TestCase):
self.fail("Filters should be allowed if they are defined on a ForeignKey pointing to this model")
class AdminViewFormUrlTest(TestCase):
urls = "regressiontests.admin_views.urls"
fixtures = ["admin-views-users.xml"]
urlbit = "admin3"
def setUp(self):
self.client.login(username='super', password='secret')
def tearDown(self):
self.client.logout()
def testChangeFormUrlHasCorrectValue(self):
"""
Tests whether change_view has form_url in request.context
"""
response = self.client.get('/test_admin/%s/admin_views/section/1/' % self.urlbit)
self.assertTrue('form_url' in response.context, msg='form_url not present in response.context')
self.assertEqual(response.context['form_url'], 'pony')
class AdminJavaScriptTest(AdminViewBasicTest):
urls = "regressiontests.admin_views.urls"
@@ -3054,6 +3073,12 @@ class UserAdminTest(TestCase):
response = self.client.get('/test_admin/admin/auth/user/%s/' % u.pk)
self.assertEqual(response.status_code, 200)
def test_form_url_present_in_context(self):
u = User.objects.all()[0]
response = self.client.get('/test_admin/admin3/auth/user/%s/password/' % u.pk)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context['form_url'], 'pony')
class GroupAdminTest(TestCase):
"""