diff --git a/conftest.py b/conftest.py index 6768306045361ca3165846f277e3ae8a1b34ade0..7f7c9d40f30fcf8417107524bcff364af9d76121 100644 --- a/conftest.py +++ b/conftest.py @@ -14,15 +14,17 @@ from program.tests.factories import ( ScheduleFactory, ShowFactory, TimeslotFactory, - TypeFactory, ImageFactory, + TypeFactory, + ImageFactory, ) def assert_data(response, data) -> None: if "schedule" in data: for key, value in data["schedule"].items(): - if key == "rrule": - assert response.data[key] == value + # this is ugly but for some reason + if key == "rrule_id" and "rrule" in response.data: + assert response.data["rrule"] == value else: assert str(response.data[key]) == value else: diff --git a/program/tests/test_notes.py b/program/tests/test_notes.py index d21fdadcaabcc7bca81efd6da49eda400df4e325..08a13d3017354d89194676d462b606fa46d13a33 100644 --- a/program/tests/test_notes.py +++ b/program/tests/test_notes.py @@ -66,9 +66,10 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase): client = self._get_client(self.user_admin) res = client.post( self._url("notes"), - self._create_random_note_content(timeslot=timeslot.id), + self._create_random_note_content(timeslot_id=timeslot.id), format="json", ) + print(res.content) self.assertEqual(res.status_code, 201) def test_notes_can_be_created_through_nested_routes(self): @@ -77,8 +78,10 @@ class NoteViewTestCase(tests.BaseMixin, APITransactionTestCase): # /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=ts1.id) + note = self._create_random_note_content(title="meh", timeslot_id=ts1.id) + print(note) res = client.post(url, note, format="json") + print(res.content) self.assertEqual(res.status_code, 201) # /shows/{pk}/timeslots/{pk}/note/ diff --git a/program/tests/test_schedules.py b/program/tests/test_schedules.py index 32dabb5c25656f601a4dfbcbd265211f26c2174a..bbbed6bfd238f6b28c6d779f0ca6c5dccced34d2 100644 --- a/program/tests/test_schedules.py +++ b/program/tests/test_schedules.py @@ -30,7 +30,7 @@ def schedule_data(rrule) -> dict[str, dict[str | int]]: "end_time": in_an_hour.strftime("%H:%M:%S"), "first_date": now.strftime("%Y-%m-%d"), "last_date": in_a_year.strftime("%Y-%m-%d"), - "rrule": rrule.id, + "rrule_id": rrule.id, "start_time": now.strftime("%H:%M:%S"), }, } @@ -209,7 +209,7 @@ def test_update_schedule(admin_api_client, once_schedule): "first_date": once_schedule.first_date, "start_time": once_schedule.start_time, "end_time": once_schedule.end_time, - "rrule": once_schedule.rrule.id, + "rrule_id": once_schedule.rrule.id, }, } diff --git a/program/tests/test_shows.py b/program/tests/test_shows.py index 3f997fd07fded45c118893f6c453d0a0feab82cf..853aeefd8c270b618495d2d79463fc070d52c248 100644 --- a/program/tests/test_shows.py +++ b/program/tests/test_shows.py @@ -12,11 +12,11 @@ def url(show=None) -> str: def show_data(funding_category, type_) -> dict[str, str | int]: return { - "funding_category": funding_category.id, + "funding_category_id": funding_category.id, "name": "NAME", "short_description": "SHORT DESCRIPTION", "slug": "SLUG", - "type": type_.id, + "type_id": type_.id, }