コード例 #1
0
ファイル: test_user_endpoints.py プロジェクト: rv3392/spotipy
    def setUpClass(cls):
        cls.four_tracks = ["spotify:track:6RtPijgfPKROxEzTHNRiDp",
                           "spotify:track:7IHOIqZUUInxjVkko181PB",
                           "4VrWlk8IQxevMvERoX08iC",
                           "http://open.spotify.com/track/3cySlItpiPiIAzU3NyHCJf"]
        cls.other_tracks = ["spotify:track:2wySlB6vMzCbQrRnNGOYKa",
                            "spotify:track:29xKs5BAHlmlX1u4gzQAbJ",
                            "spotify:track:1PB7gRWcvefzu7t3LJLUlf"]
        cls.username = os.getenv(CCEV['client_username'])

        scope = (
            'playlist-modify-public '
            'user-library-read '
            'user-follow-read '
            'user-library-modify '
            'user-read-private '
            'user-top-read '
            'user-follow-modify '
            'user-read-recently-played '
            'ugc-image-upload '
            'user-read-playback-state'
        )

        token = prompt_for_user_token(cls.username, scope=scope)

        cls.spotify = Spotify(auth=token)

        cls.new_playlist_name = 'spotipy-playlist-test'
        cls.new_playlist = helpers.get_spotify_playlist(
            cls.spotify, cls.new_playlist_name, cls.username) or \
            helpers.create_spotify_playlist(
                cls.spotify, cls.new_playlist_name, cls.username)
        cls.new_playlist_uri = cls.new_playlist['uri']
コード例 #2
0
    def setUpClass(cls):
        cls.four_tracks = [
            "spotify:track:6RtPijgfPKROxEzTHNRiDp",
            "spotify:track:7IHOIqZUUInxjVkko181PB", "4VrWlk8IQxevMvERoX08iC",
            "http://open.spotify.com/track/3cySlItpiPiIAzU3NyHCJf"
        ]
        cls.other_tracks = [
            "spotify:track:2wySlB6vMzCbQrRnNGOYKa",
            "spotify:track:29xKs5BAHlmlX1u4gzQAbJ",
            "spotify:track:1PB7gRWcvefzu7t3LJLUlf"
        ]
        cls.username = os.getenv(CCEV['client_username'])

        # be wary here, episodes sometimes go away forever
        # which could cause tests that rely on four_episodes
        # to fail

        cls.four_episodes = [
            "spotify:episode:7f9e73vfXKRqR6uCggK2Xy",
            "spotify:episode:4wA1RLFNOWCJ8iprngXmM0",
            "spotify:episode:32vhLjJjT7m3f9DFCJUCVZ",
            "spotify:episode:7cRcsGYYRUFo1OF3RgRzdx",
        ]

        scope = ('playlist-modify-public '
                 'user-library-read '
                 'user-follow-read '
                 'user-library-modify '
                 'user-read-private '
                 'user-top-read '
                 'user-follow-modify '
                 'user-read-recently-played '
                 'ugc-image-upload '
                 'user-read-playback-state')

        token = prompt_for_user_token(cls.username, scope=scope)

        cls.spotify = Spotify(auth=token)

        cls.new_playlist_name = 'spotipy-playlist-test'
        cls.new_playlist = helpers.get_spotify_playlist(
            cls.spotify, cls.new_playlist_name, cls.username) or \
            helpers.create_spotify_playlist(
                cls.spotify, cls.new_playlist_name, cls.username)
        cls.new_playlist_uri = cls.new_playlist['uri']