def test_track_writes_mp3_album(): api = SoundcloudAPI() track = api.resolve('https://soundcloud.com/if2l/2-months') assert type(track) == Track track.album = 'Made in Abyss OST' track.artist = 'Kevin Pekin' track.track_no = ":^)" with open(f'{track.artist} - {track.title}.mp3', 'wb+') as fp: track.write_mp3_to(fp)
def test_recognize_edge_case_urls(api: SoundcloudAPI): urls = ['https://soundcloud.com/nittigritti/lights-nitti-gritti-remix-1'] for url in urls: track = api.resolve(url) file = BytesIO() size = file.__sizeof__() track.write_mp3_to(file) assert file.__sizeof__() > size
def test_resolve_track(api: SoundcloudAPI): track = api.resolve(TEST_TRACK_URL) assert type(track) is Track
def test_track(): global TEST_TRACK if not TEST_TRACK: sc = SoundcloudAPI() TEST_TRACK = sc.resolve(TEST_TRACK_URL) return TEST_TRACK
def test_fetch_track_by_id_in_order(api: SoundcloudAPI): EXPECTED = [222820656, 222398079, 153576776, 289589592, 268448230] tracks = api.get_tracks(*EXPECTED) actual = [t['id'] for t in tracks] assert EXPECTED == actual