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 2 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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Incorrect category_id input for test_category
- Assertion value for test_categories_limit_low and test_categories_limit_high

## [2.21.1] - 2022-11-26
kevinsekuj marked this conversation as resolved.
Show resolved Hide resolved

### Added

- Added further unit tests for new releases, passing limit parameter with minimum and maximum values of 1 and 50
- Added further unit tests for categories, omitting country code and local to test global releases

### Fixed

- 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

### Added
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
18 changes: 17 additions & 1 deletion tests/integration/user_endpoints/test.py
Expand Up @@ -364,10 +364,18 @@ 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)

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

kevinsekuj marked this conversation as resolved.
Show resolved Hide resolved
def test_categories_limit_low(self):
response = self.spotify.categories(limit=1)
self.assertEqual(len(response['categories']['items']), 1)
Expand Down Expand Up @@ -405,7 +413,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