aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-12-19 21:22:24 +0000
committerMike Crute <mike@crute.us>2020-12-19 21:22:24 +0000
commitd1b45499b3234a8a7417bdf290f28d3626ed9f76 (patch)
treebd804541737b0bbfd183fd8fea9367658352b1db /tests
parent1af5836e5c1b727794916e2007aa96d757d0da80 (diff)
downloadpydora-d1b45499b3234a8a7417bdf290f28d3626ed9f76.tar.bz2
pydora-d1b45499b3234a8a7417bdf290f28d3626ed9f76.tar.xz
pydora-d1b45499b3234a8a7417bdf290f28d3626ed9f76.zip
Use correct token when creating stations
Track tokens should only be used when creating stations from tracks not from search results. Also return the created station from the search models when a station is created. Fixes #63 Closes #64
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pandora/test_client.py9
-rw-r--r--tests/test_pandora/test_models.py6
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/test_pandora/test_client.py b/tests/test_pandora/test_client.py
index 1c5a229..4262d34 100644
--- a/tests/test_pandora/test_client.py
+++ b/tests/test_pandora/test_client.py
@@ -177,7 +177,14 @@ class TestCreatingStation(TestCase):
177 client = APIClient(Mock(return_value={}), None, None, None, None) 177 client = APIClient(Mock(return_value={}), None, None, None, None)
178 client.create_station(artist_token="foo") 178 client.create_station(artist_token="foo")
179 client.transport.assert_called_with( 179 client.transport.assert_called_with(
180 "station.createStation", trackToken="foo", musicType="artist" 180 "station.createStation", musicToken="foo", musicType="artist"
181 )
182
183 def test_using_song_token(self):
184 client = APIClient(Mock(return_value={}), None, None, None, None)
185 client.create_station(song_token="foo")
186 client.transport.assert_called_with(
187 "station.createStation", musicToken="foo", musicType="song"
181 ) 188 )
182 189
183 def test_using_track_token(self): 190 def test_using_track_token(self):
diff --git a/tests/test_pandora/test_models.py b/tests/test_pandora/test_models.py
index 8605d1b..a155588 100644
--- a/tests/test_pandora/test_models.py
+++ b/tests/test_pandora/test_models.py
@@ -577,7 +577,7 @@ class TestArtistSearchResultItem(TestCase):
577 ) 577 )
578 result._api_client.create_station = Mock() 578 result._api_client.create_station = Mock()
579 579
580 result.create_station() 580 self.assertIsNotNone(result.create_station())
581 result._api_client.create_station.assert_called_with( 581 result._api_client.create_station.assert_called_with(
582 artist_token=result.token 582 artist_token=result.token
583 ) 583 )
@@ -614,7 +614,7 @@ class TestSongSearchResultItem(TestCase):
614 ) 614 )
615 result._api_client.create_station = Mock() 615 result._api_client.create_station = Mock()
616 616
617 result.create_station() 617 self.assertIsNotNone(result.create_station())
618 result._api_client.create_station.assert_called_with( 618 result._api_client.create_station.assert_called_with(
619 track_token=result.token 619 track_token=result.token
620 ) 620 )
@@ -650,7 +650,7 @@ class TestGenreStationSearchResultItem(TestCase):
650 ) 650 )
651 result._api_client.create_station = Mock() 651 result._api_client.create_station = Mock()
652 652
653 result.create_station() 653 self.assertIsNotNone(result.create_station())
654 result._api_client.create_station.assert_called_with( 654 result._api_client.create_station.assert_called_with(
655 search_token=result.token 655 search_token=result.token
656 ) 656 )