|
6 | 6 | from contentcuration.models import Change |
7 | 7 | from contentcuration.tests import testdata |
8 | 8 | from contentcuration.tests.base import StudioAPITestCase |
| 9 | +from contentcuration.tests.helpers import reverse_with_query |
9 | 10 | from contentcuration.tests.viewsets.base import generate_create_event |
10 | 11 | from contentcuration.tests.viewsets.base import generate_delete_event |
11 | 12 | from contentcuration.tests.viewsets.base import SyncTestMixin |
@@ -367,6 +368,28 @@ def test_fetch_users_no_permissions(self): |
367 | 368 | self.assertEqual(response.status_code, 200, response.content) |
368 | 369 | self.assertEqual(response.json(), []) |
369 | 370 |
|
| 371 | + def test_remove_self_with_invalid_channel_id_returns_bad_request(self): |
| 372 | + self.client.force_authenticate(user=self.user) |
| 373 | + response = self.client.delete( |
| 374 | + reverse_with_query( |
| 375 | + "channeluser-remove-self", |
| 376 | + kwargs={"pk": self.user.id}, |
| 377 | + query={"channel_id": "not-a-valid-uuid"}, |
| 378 | + ) |
| 379 | + ) |
| 380 | + self.assertEqual(response.status_code, 400, response.content) |
| 381 | + |
| 382 | + def test_remove_self_with_missing_channel_returns_not_found(self): |
| 383 | + self.client.force_authenticate(user=self.user) |
| 384 | + response = self.client.delete( |
| 385 | + reverse_with_query( |
| 386 | + "channeluser-remove-self", |
| 387 | + kwargs={"pk": self.user.id}, |
| 388 | + query={"channel_id": "00000000-0000-0000-0000-000000000000"}, |
| 389 | + ) |
| 390 | + ) |
| 391 | + self.assertEqual(response.status_code, 404, response.content) |
| 392 | + |
370 | 393 |
|
371 | 394 | class MarkReadNotificationsTimestampTestCase(StudioAPITestCase): |
372 | 395 | def setUp(self): |
|
0 commit comments