From df27fe93bfa2e26f298461b0b1e280d5da321474 Mon Sep 17 00:00:00 2001 From: Shukie Li <59763257+lishukie6588@users.noreply.github.com> Date: Fri, 31 May 2024 01:29:32 +0700 Subject: [PATCH] Combined assertion tests, fixes #1051 (#1052) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * addressed issue 936 * publish branch * 12/9/2023 * Update CHANGELOG.md --------- Co-authored-by: Stéphane Bruckert --- CHANGELOG.md | 3 +++ tests/integration/user_endpoints/test.py | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d48e49..8c5d064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Drop support for EOL Python 3.7. +### Fixed +- Seperated the test_current_user_save_and_usave_tracks unit test into test_current_user_save_tracks and test_current_user_unsave_tracks in the user endpoint test suite to improve unit test clarity and effectiveness for their respective user endpoints methods (current_user_saved_tracks_add, current_user_saved_tracks). + ## [2.23.0] - 2023-04-07 ### Added diff --git a/tests/integration/user_endpoints/test.py b/tests/integration/user_endpoints/test.py index d256849..93955e7 100644 --- a/tests/integration/user_endpoints/test.py +++ b/tests/integration/user_endpoints/test.py @@ -253,7 +253,7 @@ class SpotipyLibraryApiTests(unittest.TestCase): tracks = self.spotify.current_user_saved_tracks() self.assertGreaterEqual(len(tracks['items']), 0) - def test_current_user_save_and_unsave_tracks(self): + def test_current_user_save_tracks(self): tracks = self.spotify.current_user_saved_tracks() total = tracks['total'] self.spotify.current_user_saved_tracks_add(self.four_tracks) @@ -266,6 +266,19 @@ class SpotipyLibraryApiTests(unittest.TestCase): self.four_tracks) tracks = self.spotify.current_user_saved_tracks() new_total = tracks['total'] + + def test_current_user_unsave_tracks(self): + tracks = self.spotify.current_user_saved_tracks() + total = tracks['total'] + self.spotify.current_user_saved_tracks_add(self.four_tracks) + + tracks = self.spotify.current_user_saved_tracks() + new_total = tracks['total'] + + self.spotify.current_user_saved_tracks_delete( + self.four_tracks) + tracks = self.spotify.current_user_saved_tracks() + new_total = tracks['total'] self.assertEqual(new_total, total) def test_current_user_saved_albums(self):