Skip to content

Commit

Permalink
[deps] Added compatibility for djangorestframework<=3.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Aug 16, 2024
1 parent 73cd858 commit 9ce2a99
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions openwisp_notifications/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
Organization = swapper_load_model('openwisp_users', 'Organization')
OrganizationUser = swapper_load_model('openwisp_users', 'OrganizationUser')

NOT_FOUND_ERROR = ErrorDetail(string='Not found.', code='not_found')


class TestNotificationApi(
TransactionTestCase, TestOrganizationMixin, AuthenticationMixin
Expand Down Expand Up @@ -189,10 +187,6 @@ def test_retreive_notification_api(self):
url = self._get_path('notification_detail', uuid.uuid4())
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test retrieving details for existing notification'):
url = self._get_path('notification_detail', n.pk)
Expand All @@ -212,10 +206,6 @@ def test_read_single_notification_api(self):
url = self._get_path('notification_detail', uuid.uuid4())
response = self.client.patch(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test for existing notification'):
self.assertTrue(n.unread)
Expand All @@ -234,10 +224,6 @@ def test_notification_delete_api(self):
url = self._get_path('notification_detail', uuid.uuid4())
response = self.client.delete(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test for valid notification'):
url = self._get_path('notification_detail', n.pk)
Expand Down Expand Up @@ -404,13 +390,11 @@ def test_notification_recipients(self):
url = self._get_path('notification_detail', n.pk)
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.data, {'detail': NOT_FOUND_ERROR})

with self.subTest('Test marking a notification as read'):
url = self._get_path('notification_detail', n.pk)
response = self.client.patch(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.data, {'detail': NOT_FOUND_ERROR})
# Check Karen's notification is still unread
n.refresh_from_db()
self.assertTrue(n.unread)
Expand All @@ -419,7 +403,6 @@ def test_notification_recipients(self):
url = self._get_path('notification_detail', n.pk)
response = self.client.delete(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.data, {'detail': NOT_FOUND_ERROR})
# Check Karen's notification is not deleted
self.assertEqual(Notification.objects.count(), 1)

Expand Down Expand Up @@ -468,7 +451,6 @@ def test_malformed_notifications(self):
url = self._get_path('notification_detail', n.pk)
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.data, {'detail': NOT_FOUND_ERROR})

@capture_any_output()
@mock_notification_types
Expand Down Expand Up @@ -514,7 +496,6 @@ def test_obsolete_notifications_busy_worker(self, mocked_task):
url = self._get_path('notification_read_redirect', notification.pk)
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.data, {'detail': NOT_FOUND_ERROR})

def test_notification_setting_list_api(self):
self._create_org_user(is_admin=True)
Expand Down Expand Up @@ -618,10 +599,6 @@ def test_retreive_notification_setting_api(self):
url = self._get_path('notification_setting', uuid.uuid4())
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test retrieving details for existing notification setting'):
url = self._get_path(
Expand All @@ -644,10 +621,6 @@ def test_update_notification_setting_api(self):
url = self._get_path('notification_setting', uuid.uuid4())
response = self.client.put(url, data=update_data)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test retrieving details for existing notification setting'):
url = self._get_path(
Expand Down Expand Up @@ -677,7 +650,6 @@ def _unread_notification(notification):
url = self._get_path('notification_read_redirect', uuid.uuid4())
response = self.client.get(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(response.data, {'detail': NOT_FOUND_ERROR})

with self.subTest('Test existent notification'):
url = self._get_path('notification_read_redirect', notification.pk)
Expand Down Expand Up @@ -767,10 +739,6 @@ def test_delete_ignore_obj_notification_api(self, mocked_task):
)
response = self.client.delete(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test for existing object notification'):
url = self._get_path(
Expand Down Expand Up @@ -799,10 +767,6 @@ def test_retrieve_ignore_obj_notification_api(self, mocked_task):
)
response = self.client.delete(url)
self.assertEqual(response.status_code, 404)
self.assertDictEqual(
response.data,
{'detail': NOT_FOUND_ERROR},
)

with self.subTest('Test for existing object notification'):
url = self._get_path(
Expand Down

0 comments on commit 9ce2a99

Please sign in to comment.