Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for global categories, releases, fix bugged tests #893

Merged
merged 7 commits into from Nov 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -10,12 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Integration tests via GHA (non-user endpoints)
- Unit tests for new releases, passing limit parameter with minimum and maximum values of 1 and 50
- Unit tests for categories, omitting country code to test global releases

### Fixed

- Incorrect category_id input for test_category
- Assertion value for test_categories_limit_low and test_categories_limit_high
- Pin Github Actions Runner to Ubuntu 20 for Py27
- Fixed potential error where `found` variable in `test_artist_related_artists` is undefined if for loop never evaluates to true
- Fixed false positive test `test_new_releases` which looks up the wrong property of the JSON response object and always evaluates to true

## [2.21.0] - 2022-09-26

Expand Down
2 changes: 2 additions & 0 deletions tests/integration/non_user_endpoints/test.py
Expand Up @@ -158,6 +158,8 @@ def test_artist_related_artists(self):
results = self.spotify.artist_related_artists(self.weezer_urn)
self.assertTrue('artists' in results)
self.assertTrue(len(results['artists']) == 20)

found = False
for artist in results['artists']:
if artist['name'] == 'Jimmy Eat World':
found = True
Expand Down
14 changes: 13 additions & 1 deletion tests/integration/user_endpoints/test.py
Expand Up @@ -364,6 +364,10 @@ def test_categories_country(self):
response = self.spotify.categories(country='US')
self.assertGreater(len(response['categories']), 0)

def test_categories_global(self):
response = self.spotify.categories()
self.assertGreater(len(response['categories']), 0)

def test_categories_locale(self):
response = self.spotify.categories(locale='en_US')
self.assertGreater(len(response['categories']), 0)
Expand Down Expand Up @@ -405,7 +409,15 @@ def test_category_playlists_limit_high(self):

def test_new_releases(self):
response = self.spotify.new_releases()
self.assertGreater(len(response['albums']), 0)
self.assertGreater(len(response['albums']['items']), 0)

def test_new_releases_limit_low(self):
response = self.spotify.new_releases(limit=1)
self.assertEqual(len(response['albums']['items']), 1)

def test_new_releases_limit_high(self):
response = self.spotify.new_releases(limit=50)
self.assertLessEqual(len(response['albums']['items']), 50)

def test_featured_releases(self):
response = self.spotify.featured_playlists()
Expand Down