mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Merge 752cf7b41d
into 836e49b535
This commit is contained in:
commit
47277d71cc
|
@ -79,20 +79,20 @@ class TemplateHTMLRendererTests(TestCase):
|
||||||
|
|
||||||
def test_simple_html_view(self):
|
def test_simple_html_view(self):
|
||||||
response = self.client.get('/')
|
response = self.client.get('/')
|
||||||
self.assertContains(response, "example: foobar")
|
assert "example: foobar" in response
|
||||||
self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
|
assert response['Content-Type'] == 'text/html; charset=utf-8'
|
||||||
|
|
||||||
def test_not_found_html_view(self):
|
def test_not_found_html_view(self):
|
||||||
response = self.client.get('/not_found')
|
response = self.client.get('/not_found')
|
||||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
assert response.status_code == status.HTTP_404_NOT_FOUND
|
||||||
self.assertEqual(response.content, six.b("404 Not Found"))
|
assert response.content == six.b("404 Not Found")
|
||||||
self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
|
assert response['Content-Type'] == 'text/html; charset=utf-8'
|
||||||
|
|
||||||
def test_permission_denied_html_view(self):
|
def test_permission_denied_html_view(self):
|
||||||
response = self.client.get('/permission_denied')
|
response = self.client.get('/permission_denied')
|
||||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
assert response.status_code == status.HTTP_403_FORBIDDEN
|
||||||
self.assertEqual(response.content, six.b("403 Forbidden"))
|
assert response.content == six.b("403 Forbidden")
|
||||||
self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
|
assert response['Content-Type'] == 'text/html; charset=utf-8'
|
||||||
|
|
||||||
# 2 tests below are based on order of if statements in corresponding method
|
# 2 tests below are based on order of if statements in corresponding method
|
||||||
# of TemplateHTMLRenderer
|
# of TemplateHTMLRenderer
|
||||||
|
@ -154,14 +154,12 @@ class TemplateHTMLRendererExceptionTests(TestCase):
|
||||||
|
|
||||||
def test_not_found_html_view_with_template(self):
|
def test_not_found_html_view_with_template(self):
|
||||||
response = self.client.get('/not_found')
|
response = self.client.get('/not_found')
|
||||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
assert response.status_code == status.HTTP_404_NOT_FOUND
|
||||||
self.assertTrue(response.content in (
|
assert (six.b("404: Not found"), six.b("404 Not Found")) in response.content
|
||||||
six.b("404: Not found"), six.b("404 Not Found")))
|
assert response['Content-Type'] == 'text/html; charset=utf-8'
|
||||||
self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
|
|
||||||
|
|
||||||
def test_permission_denied_html_view_with_template(self):
|
def test_permission_denied_html_view_with_template(self):
|
||||||
response = self.client.get('/permission_denied')
|
response = self.client.get('/permission_denied')
|
||||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
assert response.status_code == status.HTTP_403_FORBIDDEN
|
||||||
self.assertTrue(response.content in (
|
assert (six.b("403: Permission denied"), six.b("403 Forbidden")) in response.content
|
||||||
six.b("403: Permission denied"), six.b("403 Forbidden")))
|
assert response['Content-Type'] == 'text/html; charset=utf-8'
|
||||||
self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user