diff options
| author | Keryn Knight <keryn@kerynknight.com> | 2013-09-07 14:20:04 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-09-11 08:48:32 -0400 |
| commit | 170f72136758add6c9c0c59240cfce73d5672cc2 (patch) | |
| tree | 9eab613ef2eb28ea43b117bc5f415c5ab2a98349 /tests | |
| parent | da843e7dba4ae8ed2846475564bb6ded82960827 (diff) | |
Fixed #21056 -- AdminSite.app_index no longer blindly accepts any app-labelish input.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/tests.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 19bf00f302..75e8a51acd 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -9,7 +9,7 @@ import unittest from django.conf import settings, global_settings from django.core import mail from django.core.files import temp as tempfile -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse, NoReverseMatch # Register auth models with the admin. from django.contrib.auth import get_permission_codename from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME @@ -640,6 +640,20 @@ class AdminViewBasicTest(AdminViewBasicTestCase): # Check the format of the shown object -- shouldn't contain a change link self.assertContains(response, '<th class="field-__str__">UnchangeableObject object</th>', html=True) + def test_invalid_appindex_url(self): + """ + #21056 -- URL reversing shouldn't work for nonexistent apps. + """ + good_url = '/test_admin/admin/admin_views/' + confirm_good_url = reverse('admin:app_list', + kwargs={'app_label': 'admin_views'}) + self.assertEqual(good_url, confirm_good_url) + + with self.assertRaises(NoReverseMatch): + reverse('admin:app_list', kwargs={'app_label': 'this_should_fail'}) + with self.assertRaises(NoReverseMatch): + reverse('admin:app_list', args=('admin_views2',)) + @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) class AdminViewFormUrlTest(TestCase): |
