From a9f367c443b9f9333d8141f94e1a57aa281571e4 Mon Sep 17 00:00:00 2001 From: Xander Vertegaal Date: Fri, 25 Oct 2024 12:31:14 +0200 Subject: [PATCH] Add episode order mutation test --- backend/event/tests/test_event_mutations.py | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 backend/event/tests/test_event_mutations.py diff --git a/backend/event/tests/test_event_mutations.py b/backend/event/tests/test_event_mutations.py new file mode 100644 index 00000000..ca1178db --- /dev/null +++ b/backend/event/tests/test_event_mutations.py @@ -0,0 +1,24 @@ +from event.models import Episode + + +def test_episode_order_mutation(graphql_client, episode): + result = graphql_client.execute( + f""" + mutation TestMutation {{ + updateEpisodeOrder( + episodeOrderData: [ + {{ id: "{episode.id}", rank: 5 }} + ] + ) {{ + ok + errors {{ + field + messages + }} + }} + }} + """ + ) + assert result["data"]["updateEpisodeOrder"]["ok"] == True + assert result["data"]["updateEpisodeOrder"]["errors"] == [] + assert Episode.objects.get(id=episode.id).rank == 5