From ed2393e9a8405a17b4e6a006b7d854e23fada78d Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Wed, 30 Oct 2024 18:04:45 -0400 Subject: [PATCH] test: add test to update & clear the default playlist id --- program/tests/test_shows.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/program/tests/test_shows.py b/program/tests/test_shows.py index 2cd94a4f..79ed7bde 100644 --- a/program/tests/test_shows.py +++ b/program/tests/test_shows.py @@ -176,3 +176,26 @@ def test_update_show_forbidden_for_common_user( response = common_api_client1.patch(url(show), data=update, format="json") assert response.status_code == 403 + + +def test_update_default_playlist_id(admin_api_client, show, default_playlist): + update = {"default_playlist_id": default_playlist.id} + + response = admin_api_client.patch(url(show=show), data=update) + + assert response.status_code == 200 + + assert response.data["default_playlist_id"] == update["default_playlist_id"] + + +def test_clear_default_playlist_id(admin_api_client, show, default_playlist): + show.default_playlist = default_playlist + show.save() + + update = {"default_playlist_id": None} + + response = admin_api_client.patch(url(show=show), data=update, format="json") + + assert response.status_code == 200 + + assert response.data["default_playlist_id"] == update["default_playlist_id"] -- GitLab