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

Fixed #32771 -- Used IS_POPUP_VAR constant instead of hard-coded value.

This commit is contained in:
David Sanders
2021-05-19 11:10:58 -07:00
committed by Mariusz Felisiak
parent 6e155d280d
commit 2978c63a34
7 changed files with 17 additions and 14 deletions

View File

@@ -293,7 +293,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
Ensure http response from a popup is properly escaped.
"""
post_data = {
'_popup': '1',
IS_POPUP_VAR: '1',
'title': 'title with a new\nline',
'content': 'some content',
'date_0': '2010-09-10',
@@ -5391,17 +5391,17 @@ class UserAdminTest(TestCase):
response = self.client.get(reverse('admin:admin_views_album_add'))
self.assertContains(response, reverse('admin:auth_user_add'))
self.assertContains(response, 'class="related-widget-wrapper-link add-related" id="add_id_owner"')
response = self.client.get(reverse('admin:auth_user_add') + '?_popup=1')
response = self.client.get(reverse('admin:auth_user_add') + '?%s=1' % IS_POPUP_VAR)
self.assertNotContains(response, 'name="_continue"')
self.assertNotContains(response, 'name="_addanother"')
data = {
'username': 'newuser',
'password1': 'newpassword',
'password2': 'newpassword',
'_popup': '1',
IS_POPUP_VAR: '1',
'_save': '1',
}
response = self.client.post(reverse('admin:auth_user_add') + '?_popup=1', data, follow=True)
response = self.client.post(reverse('admin:auth_user_add') + '?%s=1' % IS_POPUP_VAR, data, follow=True)
self.assertContains(response, '"obj": "newuser"')
def test_user_fk_change_popup(self):
@@ -5410,7 +5410,7 @@ class UserAdminTest(TestCase):
self.assertContains(response, reverse('admin:auth_user_change', args=('__fk__',)))
self.assertContains(response, 'class="related-widget-wrapper-link change-related" id="change_id_owner"')
user = User.objects.get(username='changeuser')
url = reverse('admin:auth_user_change', args=(user.pk,)) + '?_popup=1'
url = reverse('admin:auth_user_change', args=(user.pk,)) + '?%s=1' % IS_POPUP_VAR
response = self.client.get(url)
self.assertNotContains(response, 'name="_continue"')
self.assertNotContains(response, 'name="_addanother"')
@@ -5422,7 +5422,7 @@ class UserAdminTest(TestCase):
'last_login_1': '13:20:10',
'date_joined_0': '2007-05-30',
'date_joined_1': '13:20:10',
'_popup': '1',
IS_POPUP_VAR: '1',
'_save': '1',
}
response = self.client.post(url, data, follow=True)
@@ -5435,12 +5435,12 @@ class UserAdminTest(TestCase):
self.assertContains(response, reverse('admin:auth_user_delete', args=('__fk__',)))
self.assertContains(response, 'class="related-widget-wrapper-link change-related" id="change_id_owner"')
user = User.objects.get(username='changeuser')
url = reverse('admin:auth_user_delete', args=(user.pk,)) + '?_popup=1'
url = reverse('admin:auth_user_delete', args=(user.pk,)) + '?%s=1' % IS_POPUP_VAR
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
data = {
'post': 'yes',
'_popup': '1',
IS_POPUP_VAR: '1',
}
response = self.client.post(url, data, follow=True)
self.assertContains(response, '"action": "delete"')