mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 19:40:13 +03:00
add unit test (test_permission_denied_for_object_with_custom_detail_by_anonymous_user)
This commit is contained in:
parent
51d5fde5c9
commit
b54c7221e8
|
@ -522,3 +522,11 @@ class CustomPermissionsTests(TestCase):
|
|||
detail = response.data.get('detail')
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
self.assertEqual(detail, self.custom_message)
|
||||
|
||||
def test_permission_denied_for_object_with_custom_detail_by_anonymous_user(self):
|
||||
anonymous_request = factory.get('/1', format='json')
|
||||
response = denied_object_view_with_detail(anonymous_request, pk=1)
|
||||
detail = response.data.get('detail')
|
||||
print(response.status_code, detail)
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
self.assertEqual(detail, self.custom_message)
|
||||
|
|
Loading…
Reference in New Issue
Block a user