summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2008-10-22 23:09:35 +0000
committerKaren Tracey <kmtracey@gmail.com>2008-10-22 23:09:35 +0000
commit30241385d538a9d6abb89ff9f74dfd5a424c7a87 (patch)
tree75a5f38ca848fb4873c1bd9356ab476ae6ffb1a1 /tests
parent5e5af8a8aae3c860f2b9463b2a5df713fc53d6d0 (diff)
Fixed #9252 -- Moved the try/except protecting against incorrect lookup params to where the error is now raised, and added a test for this case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9245 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/admin_views/tests.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index bc9d1d49ae..f335c093de 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -160,7 +160,14 @@ class AdminViewBasicTest(TestCase):
'<a href="?color__id__exact=3">Blue</a>' in response.content,
"Changelist filter not correctly limited by limit_choices_to."
)
-
+
+ def testIncorrectLookupParameters(self):
+ """Ensure incorrect lookup parameters are handled gracefully."""
+ response = self.client.get('/test_admin/admin/admin_views/thing/', {'notarealfield': '5'})
+ self.assertRedirects(response, '/test_admin/admin/admin_views/thing/?e=1')
+ response = self.client.get('/test_admin/admin/admin_views/thing/', {'color__id__exact': 'StringNotInteger!'})
+ self.assertRedirects(response, '/test_admin/admin/admin_views/thing/?e=1')
+
def get_perm(Model, perm):
"""Return the permission object, for the Model"""
ct = ContentType.objects.get_for_model(Model)