Skip to content
Snippets Groups Projects
Verified Commit 31956b82 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

test: remove skiped note tests with nested routes

parent 82a939d6
No related branches found
No related tags found
No related merge requests found
from rest_framework.test import APITransactionTestCase from rest_framework.test import APITransactionTestCase
from unittest import skip
from program import tests from program import tests
from program.models import Schedule, Show from program.models import Schedule, Show
...@@ -70,57 +70,3 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase): ...@@ -70,57 +70,3 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase):
format="json", format="json",
) )
self.assertEqual(res.status_code, 201) 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment