Combined assertion tests, fixes #1051 (#1052)

* addressed issue 936

* publish branch

* 12/9/2023

* Update CHANGELOG.md

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
This commit is contained in:
Shukie Li 2024-05-31 01:29:32 +07:00 committed by GitHub
parent 62a27a20e0
commit df27fe93bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -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. - 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 ## [2.23.0] - 2023-04-07
### Added ### Added

View File

@ -253,7 +253,7 @@ class SpotipyLibraryApiTests(unittest.TestCase):
tracks = self.spotify.current_user_saved_tracks() tracks = self.spotify.current_user_saved_tracks()
self.assertGreaterEqual(len(tracks['items']), 0) 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() tracks = self.spotify.current_user_saved_tracks()
total = tracks['total'] total = tracks['total']
self.spotify.current_user_saved_tracks_add(self.four_tracks) self.spotify.current_user_saved_tracks_add(self.four_tracks)
@ -266,6 +266,19 @@ class SpotipyLibraryApiTests(unittest.TestCase):
self.four_tracks) self.four_tracks)
tracks = self.spotify.current_user_saved_tracks() tracks = self.spotify.current_user_saved_tracks()
new_total = tracks['total'] 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) self.assertEqual(new_total, total)
def test_current_user_saved_albums(self): def test_current_user_saved_albums(self):