1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Replaced hardcoded URLs in admin_* tests

Refs #15779. This will allow easier admin URL changes, when needed.
Thanks Simon Charette for the review.
This commit is contained in:
Claude Paroz
2015-02-06 23:25:15 +01:00
parent 9033003d97
commit 32e6a7d3a5
8 changed files with 693 additions and 647 deletions

View File

@@ -26,7 +26,9 @@ class AdminCustomUrlsTest(TestCase):
"""
Ensure GET on the add_view works.
"""
response = self.client.get('/admin/admin_custom_urls/action/!add/')
add_url = reverse('admin:admin_custom_urls_action_add')
self.assertTrue(add_url.endswith('/!add/'))
response = self.client.get(add_url)
self.assertIsInstance(response, TemplateResponse)
self.assertEqual(response.status_code, 200)
@@ -35,7 +37,7 @@ class AdminCustomUrlsTest(TestCase):
Ensure GET on the add_view plus specifying a field value in the query
string works.
"""
response = self.client.get('/admin/admin_custom_urls/action/!add/', {'name': 'My Action'})
response = self.client.get(reverse('admin:admin_custom_urls_action_add'), {'name': 'My Action'})
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="My Action"')
@@ -48,7 +50,7 @@ class AdminCustomUrlsTest(TestCase):
"name": 'Action added through a popup',
"description": "Description of added action",
}
response = self.client.post('/admin/admin_custom_urls/action/!add/', post_data)
response = self.client.post(reverse('admin:admin_custom_urls_action_add'), post_data)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'dismissAddRelatedObjectPopup')
self.assertContains(response, 'Action added through a popup')