Add request attribute exception test

This commit is contained in:
Ryan P Kilby 2017-11-22 01:37:56 -05:00
parent 19f4425cb4
commit 03c581eee3

View File

@ -263,3 +263,12 @@ class TestWSGIRequestProxy(TestCase):
outer_sentinel = object()
request.inner_property = outer_sentinel
assert request.inner_property is outer_sentinel
def test_exception(self):
# ensure the exception message is not for the underlying WSGIRequest
wsgi_request = factory.get('/')
request = Request(wsgi_request)
message = "'Request' object has no attribute 'inner_property'"
with self.assertRaisesMessage(AttributeError, message):
request.inner_property