Completed test coverage of views.defaults.bad_request().

This commit is contained in:
Hasan Ramezani 2018-10-26 02:03:58 +02:00 committed by Tim Graham
parent 717ee63e56
commit 55b0b766fb
1 changed files with 7 additions and 0 deletions

View File

@ -72,6 +72,13 @@ class DefaultsTests(TestCase):
response = self.client.get('/server_error/')
self.assertEqual(response.status_code, 500)
def test_bad_request(self):
rf = RequestFactory()
request = rf.get('/')
response = bad_request(request, Exception())
self.assertEqual(response.status_code, 400)
self.assertEqual(response.content, b'<h1>Bad Request (400)</h1>')
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {