Skip to content

Commit 3c1c958

Browse files
committed
Update reminder tests for new soft-deleted behaviour
1 parent b92aa76 commit 3c1c958

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pydis_site/apps/api/tests/test_reminders.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def test_delete_known_reminder_returns_204(self):
114114
response = self.client.delete(url)
115115

116116
self.assertEqual(response.status_code, 204)
117-
self.assertRaises(Reminder.DoesNotExist, Reminder.objects.get, id=self.reminder.id)
118117

119118

120119
class ReminderListTests(AuthenticatedAPITestCase):
@@ -154,18 +153,26 @@ def test_reminders_in_full_list(self):
154153
response = self.client.get(url)
155154

156155
self.assertEqual(response.status_code, 200)
156+
self.assertNotIn(self.rem_dict_two, response.json())
157+
158+
response = self.client.get(f"{url}?include_inactive=true")
157159
self.assertCountEqual(response.json(), [self.rem_dict_one, self.rem_dict_two])
158160

159161
def test_filter_search(self):
160162
url = reverse('api:bot:reminder-list')
161163
response = self.client.get(f'{url}?search={self.author.name}')
164+
self.assertEqual(response.status_code, 200)
165+
self.assertCountEqual(response.json(), [self.rem_dict_one])
162166

167+
def test_filter_search_with_inactive(self):
168+
url = reverse('api:bot:reminder-list')
169+
response = self.client.get(f'{url}?search={self.author.name}&include_inactive=true')
163170
self.assertEqual(response.status_code, 200)
164171
self.assertCountEqual(response.json(), [self.rem_dict_one, self.rem_dict_two])
165172

166-
def test_filter_field(self):
173+
def test_only_active_by_default(self):
167174
url = reverse('api:bot:reminder-list')
168-
response = self.client.get(f'{url}?active=true')
175+
response = self.client.get(url)
169176

170177
self.assertEqual(response.status_code, 200)
171178
self.assertEqual(response.json(), [self.rem_dict_one])

0 commit comments

Comments
 (0)