From 31956b821beff5d1ce86badbde19363cade32c55 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Wed, 20 Mar 2024 20:23:52 -0400 Subject: [PATCH] test: remove skiped note tests with nested routes --- program/tests/test_notes.py | 56 +------------------------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/program/tests/test_notes.py b/program/tests/test_notes.py index 0db1d9a9..c16f048d 100644 --- a/program/tests/test_notes.py +++ b/program/tests/test_notes.py @@ -1,5 +1,5 @@ from rest_framework.test import APITransactionTestCase -from unittest import skip + from program import tests from program.models import Schedule, Show @@ -70,57 +70,3 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase): format="json", ) self.assertEqual(res.status_code, 201) - - @skip("nested routes are deprecated") - def test_notes_can_be_created_through_nested_routes(self): - client = self._get_client(self.user_admin) - - # /shows/{pk}/notes/ - ts1 = self._create_timeslot(schedule=self.schedule_musikrotation) - url = self._url("shows", self.show_musikrotation.id, "notes") - note = self._create_random_note_content(title="meh", timeslot_id=ts1.id) - res = client.post(url, note, format="json") - self.assertEqual(res.status_code, 201) - - # /shows/{pk}/timeslots/{pk}/note/ - ts2 = self._create_timeslot(schedule=self.schedule_musikrotation) - url = self._url("shows", self.show_musikrotation, "timeslots", ts2.id, "note") - note = self._create_random_note_content(title="cool") - res = client.post(url, note, format="json") - self.assertEqual(res.status_code, 201) - - @skip("nested routes are deprecated") - def test_notes_can_be_filtered_through_nested_routes_and_query_params(self): - client = self._get_client() - - ts1 = self._create_timeslot(schedule=self.schedule_musikrotation) - ts2 = self._create_timeslot(schedule=self.schedule_beatbetrieb) - ts3 = self._create_timeslot(schedule=self.schedule_beatbetrieb) - n1 = self._create_note(timeslot=ts1) - n2 = self._create_note(timeslot=ts2) - n3 = self._create_note(timeslot=ts3) - - def _get_ids(res): - return set(ts["id"] for ts in res.data) - - # /shows/{pk}/notes/ - query_res = client.get(self._url("notes") + f"?showIds={self.show_beatbetrieb.id}") - route_res = client.get(self._url("shows", self.show_beatbetrieb.id, "notes")) - ids = {n2.id, n3.id} - self.assertEqual(_get_ids(query_res), ids) - self.assertEqual(_get_ids(route_res), ids) - - query_res = client.get(self._url("notes") + f"?showIds={self.show_musikrotation.id}") - route_res = client.get(self._url("shows", self.show_musikrotation.id, "notes")) - ids = {n1.id} - self.assertEqual(_get_ids(query_res), ids) - self.assertEqual(_get_ids(route_res), ids) - - # /shows/{pk}/timeslots/{pk}/note/ - query_res = client.get(self._url("notes") + f"?timeslot={ts2.id}") - route_res = client.get( - self._url("shows", self.show_beatbetrieb.id, "timeslots", ts2.id, "note") - ) - ids = {n2.id} - self.assertEqual(_get_ids(query_res), ids) - self.assertEqual(_get_ids(route_res), ids) -- GitLab