test: Fix notifacitons test for new DRF version.
DRF was swallowing an underlying error string and providing its own which was being checked for here. See https://github.com/encode/django-rest-framework/pull/8051 for details. The new version fixes that underlying issue and so the test failed. Rather than checking for the exact string of the 404 which is not relevant, we now just verify that the error code associated with the request matches the HTTP response. This should make the test more resilient to future text changes in the underlying Django function `get_object_or_404`
This commit is contained in:
@@ -443,7 +443,7 @@ class NotificationReadAPIViewTestCase(APITestCase):
|
||||
response = self.client.patch(self.url, data)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
self.assertEqual(response.data["detail"], 'Not found.')
|
||||
self.assertEqual(response.data["detail"].code, 'not_found')
|
||||
|
||||
def test_mark_notification_read_with_app_name_and_notification_id(self):
|
||||
# Create a PATCH request to mark notification as read for existing app e.g 'discussion' and notification_id: 2
|
||||
|
||||
Reference in New Issue
Block a user