def test_get_home_page(self): client = Client() for channel_id in Client.CHANNEL_ID_LIST: result = client.get_homepage(channel_id) pass pass
def test_get_channel_formats(self): client = Client() for channel_id in Client.CHANNEL_ID_LIST: result = client.get_formats(channel_id) pass pass
def test_follow(self): login_data = Client().login(username=self.USERNAME, password=self.PASSWORD) client = Client(access_token=login_data['access_token']) json_data = client.follow_user(1647796, False) self.assertGreater(len(json_data), 0) json_data = client.follow_user(1647796, True) self.assertGreater(len(json_data), 0) pass
def test_get_video_streams(self): format_ids = ['pro7:277', 'pro7:505'] client = Client() json_data = client.get_new_videos(format_ids) item = json_data['items'][0] video_data = client.get_video_url(item['id']) pass
def test_calculate_request_signature(self): client = Client() sig = client.calculate_request_signature(time_stamp=1414434266907) self.assertEqual('7782bff6e9d3602c90379ee595fbc4620ba2dd2b', sig) sig = client.calculate_request_signature(time_stamp=1414434267559) self.assertEqual('88807861fe02b508b0604f578a56ecfeabb3be79', sig) pass
def test_resolve_url(self): client = Client() url = 'http://soundcloud.com/qdance/luna-presents-minus-is-more-december-2014-yearmix' json_data = client.resolve_url(url) url = 'http://soundcloud.com/julyukie/sets/juliana-yamasaki-new-tracks' json_data = client.resolve_url(url) pass
def test_login(self): login_data = Client().login(username=self.USERNAME, password=self.PASSWORD) self.assertRaises(nightcrawler.CredentialsException, Client().login, username=self.USERNAME, password='******') pass
def test_get_format_video(self): client = Client() result = client.get_format_videos('pro7', 'pro7:505', page=2) objects = result.get('objects', []) self.assertGreater(len(objects), 0) for video in objects: print video['title'] pass pass
def test_play(self): provider = Provider() client = Client() videos = client.get_feed(40) video_id = videos[1]['id'] context = nightcrawler.Context(path='/play/', params={'video_id': video_id}) settings = context.get_settings() settings.set_int(settings.VIDEO_QUALITY, 4) result = provider.navigate(context) pass
class TestClient(unittest.TestCase): def setUp(self): self._client = Client() access_data = self._client.authenticate() self._client = Client(access_data['access_token']) pass def test_get_posts(self): video_data = self._client.get_posts('LJEGX') next_reference_key = video_data.get('next_reference_key', '') while next_reference_key: video_data = self._client.get_posts('LJEGX', next_reference_key=next_reference_key) next_reference_key = video_data.get('next_reference_key', '') pass pass def test_get_available(self): client = self._client categories = client.get_available() for category in categories: video_data = self._client.get_posts(category['id']) self.assertGreater(len(video_data['items']), 0) pass pass def test_authenticate(self): client = Client() access_token, expires = client.authenticate() pass def test_calculate_request_signature(self): client = Client() sig = client.calculate_request_signature(time_stamp=1414434266907) self.assertEqual('7782bff6e9d3602c90379ee595fbc4620ba2dd2b', sig) sig = client.calculate_request_signature(time_stamp=1414434267559) self.assertEqual('88807861fe02b508b0604f578a56ecfeabb3be79', sig) pass pass
def test_get_track(self): client = Client() json_data = client.get_track(193347852) pass
def test_user(self): client = Client() json_data = client.get_user(1701116) pass
def test_get_follower(self): client = Client() json_data = client.get_follower(520685) pass
def test_get_playlists(self): client = Client() json_data = client.get_playlists(520685) pass
def test_search(self): client = Client() tracks = client.search('angerfist', category='sounds') pass
def test_get_categories(self): client = Client() result = client.get_categories() pass
def test_get_home(self): client = Client() categories = client.get_home() self.assertGreaterEqual(len(categories), 0) pass
def test_get_format_content(self): client = Client() result = client.get_format_content('pro7', 'pro7:789') pass
def test_get_recommended_for_track(self): client = Client() json_data = client.get_recommended_for_track(193347852, page=1) pass
def test_get_track_url(self): client = Client() url = client.get_track_url(193347852) pass
def test_get_likes(self): client = Client() json_data = client.get_likes(520685) pass
def test_get_video_streams(self): client = Client() videos = client.get_feed(40) video_id = videos[0]['id'] json_data = client.get_video_streams(video_id) pass
def test_search(self): client = Client() result = client.search('halligalli') pass
def test_tracks(self): client = Client() json_data = client.get_tracks(1701116) pass
def test_get_new_video(self): format_ids = ['pro7:277', 'pro7:505'] client = Client() json_data = client.get_new_videos(format_ids) pass
def test_get_genre(self): client = Client() result = client.get_genre('techno') pass
def test_get_playlist(self): client = Client() json_data = client.get_playlist(55019726) self.assertGreater(len(json_data), 0) pass
def test_get_trending(self): client = Client() result = client.get_trending('audio') pass
def test_search(self): client = Client() xml = client.search('superman') pass
def test_authenticate(self): client = Client() access_token, expires = client.authenticate() pass
def test_search(self): client = Client() tracks = client.search('angerfist', category='sounds') playlist = client.search('angerfist', category='sets') people = client.search('angerfist', category='people') pass
def test_get_feed(self): client = Client() feed = client.get_feed(40) pass
def test_get_stream(self): login_data = Client().login(username=self.USERNAME, password=self.PASSWORD) client = Client(access_token=login_data['access_token']) json_data = client.get_stream() pass
def setUp(self): self._client = Client() access_data = self._client.authenticate() self._client = Client(access_data['access_token']) pass