summaryrefslogtreecommitdiff
path: root/tests/get_object_or_404/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/get_object_or_404/tests.py')
-rw-r--r--tests/get_object_or_404/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/get_object_or_404/tests.py b/tests/get_object_or_404/tests.py
index a72b766524..075f9a08e1 100644
--- a/tests/get_object_or_404/tests.py
+++ b/tests/get_object_or_404/tests.py
@@ -94,3 +94,13 @@ class GetObjectOr404Tests(TestCase):
msg = "First argument to get_list_or_404() must be a Model, Manager, or QuerySet, not 'list'."
with self.assertRaisesMessage(ValueError, msg):
get_list_or_404([Article], title__icontains="Run")
+
+ def test_get_object_or_404_queryset_attribute_error(self):
+ """AttributeError raised by QuerySet.get() isn't hidden."""
+ with self.assertRaisesMessage(AttributeError, 'AttributeErrorManager'):
+ get_object_or_404(Article.attribute_error_objects, id=42)
+
+ def test_get_list_or_404_queryset_attribute_error(self):
+ """AttributeError raised by QuerySet.filter() isn't hidden."""
+ with self.assertRaisesMessage(AttributeError, 'AttributeErrorManager'):
+ get_list_or_404(Article.attribute_error_objects, title__icontains='Run')