class CharterRdioAPITests(unittest.TestCase): def setUp(self): self.rdio = Rdio((RDIO_CONSUMER_KEY, RDIO_CONSUMER_SECRET), RDIO_TEST_OAUTH_TOKEN) test_playlist = self.rdio.call( 'createPlaylist', { 'name': 'charter test', 'description': 'test charts', 'tracks': 't10016979,t28083363,t7357573' }) self.playlist = test_playlist['result'] self.playlist_key = self.playlist['key'] self.charter = Charter(rdio=self.rdio) def tearDown(self): self.rdio.call('deletePlaylist', {'playlist': self.playlist_key}) def test_changing_order(self): expected_update = ['t28083363', 't7357573', 't10016979'] self.charter.updatePlaylist(self.playlist_key, expected_update) playlist = self.rdio.call('get', params={ 'keys': self.playlist_key, 'extras': '-*,name,trackKeys' }) actual_tracks = playlist['result'][self.playlist_key]['trackKeys'] self.assertListEqual(actual_tracks, expected_update)
def setUp(self): self.rdio = Rdio((RDIO_CONSUMER_KEY, RDIO_CONSUMER_SECRET), RDIO_TEST_OAUTH_TOKEN) test_playlist = self.rdio.call( 'createPlaylist', { 'name': 'charter test', 'description': 'test charts', 'tracks': 't10016979,t28083363,t7357573' }) self.playlist = test_playlist['result'] self.playlist_key = self.playlist['key'] self.charter = Charter(rdio=self.rdio)
def setUp(self): self.rdio = Rdio((RDIO_CONSUMER_KEY, RDIO_CONSUMER_SECRET), RDIO_TEST_OAUTH_TOKEN) test_playlist = self.rdio.call('createPlaylist', {'name': 'charter test', 'description': 'test charts', 'tracks': 't10016979,t28083363,t7357573'}) self.playlist = test_playlist['result'] self.playlist_key = self.playlist['key'] self.charter = Charter(rdio=self.rdio)
class CharterRdioAPITests(unittest.TestCase): def setUp(self): self.rdio = Rdio((RDIO_CONSUMER_KEY, RDIO_CONSUMER_SECRET), RDIO_TEST_OAUTH_TOKEN) test_playlist = self.rdio.call('createPlaylist', {'name': 'charter test', 'description': 'test charts', 'tracks': 't10016979,t28083363,t7357573'}) self.playlist = test_playlist['result'] self.playlist_key = self.playlist['key'] self.charter = Charter(rdio=self.rdio) def tearDown(self): self.rdio.call('deletePlaylist', {'playlist': self.playlist_key}) def test_changing_order(self): expected_update = ['t28083363', 't7357573', 't10016979'] self.charter.updatePlaylist(self.playlist_key, expected_update) playlist = self.rdio.call('get', params={'keys': self.playlist_key, 'extras': '-*,name,trackKeys'}) actual_tracks = playlist['result'][self.playlist_key]['trackKeys'] self.assertListEqual(actual_tracks, expected_update)
if __name__ == '__main__': from charter.charter import Charter import config from rdio.rdio import Rdio import scraper rdio = Rdio((config.RDIO_CONSUMER_KEY, config.RDIO_CONSUMER_SECRET), config.RDIO_TEST_OAUTH_TOKEN) charter = Charter(rdio=rdio) scraper.chartList() new_chart = scraper.scrapeChart('http://www.billboard.com/charts/hot-100') charter.updatePlaylist('my playlist key', new_chart)