diff options
Diffstat (limited to 'tests/admin_views')
| -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): |
