示例#1
0
 def test_artwork_url(self):
     lib = SoundcloudLibrary(self.FakeClient())
     lib.query_with_refresh("")
     s = list(lib._contents.values())[0]
     self.failUnlessEqual(
         s("artwork_url"),
         "https://i1.sndcdn.com/artworks-000108682375-q4j7y6-t500x500.jpg")
 def test_artwork_url(self):
     lib = SoundcloudLibrary(self.FakeClient())
     lib.query_with_refresh("")
     s = lib._contents.values()[0]
     self.failUnlessEqual(
         s("artwork_url"),
         "https://i1.sndcdn.com/artworks-000108682375-q4j7y6-t500x500.jpg")
示例#3
0
class TSoundcloudLibrary(TestCase):
    class FakeClient(SoundcloudApiClient):
        def get_tracks(self, query):
            self._on_track_data(None, [self._track], None)

        def __init__(self):
            super().__init__()
            with open(TEST_DATA_PATH / "soundcloud_track_response.json") as f:
                self._track = json.load(f)

        def authenticate_user(self):
            pass

    def setUp(self):
        SoundcloudLibrary.librarian = None
        self.lib = SoundcloudLibrary(self.FakeClient())

    def tearDown(self):
        self.lib.destroy()

    @classmethod
    def setUpClass(cls):
        config.RATINGS = config.HardCodedRatingsPrefs()

    def test_parse(self):
        lib = self.lib
        lib.query_with_refresh("dummy search")
        songs = list(lib._contents.values())
        assert len(songs) == 1
        s = songs[0]
        assert s("artist") == "ANDY C ram"
        assert s("date") == "2015-06-29"
        assert s("~year") == "2015"
        assert s("~#download_count") == 0
        assert s("~#playback_count") == 363310
        assert s("~#favoritings_count") == 10061
        assert s("~#rating") == 1.0
        assert s("~#playcount") == 4
        assert int(s("~#bitrate")) == 128

    def test_artwork_url(self):
        lib = SoundcloudLibrary(self.FakeClient())
        lib.query_with_refresh("")
        s = list(lib._contents.values())[0]
        url = s("artwork_url")
        assert url == "https://i1.sndcdn.com/artworks-000121689963-0b0pdr-t500x500.jpg"
示例#4
0
class TSoundcloudLibrary(TestCase):
    class FakeClient(SoundcloudApiClient):

        def get_tracks(self, query):
            self._on_track_data(None, [TRACK], None)

        def __init__(self):
            super().__init__()

        def authenticate_user(self):
            pass

    def setUp(self):
        SoundcloudLibrary.librarian = None
        self.lib = SoundcloudLibrary(self.FakeClient())

    def tearDown(self):
        self.lib.destroy()

    @classmethod
    def setUpClass(cls):
        config.RATINGS = config.HardCodedRatingsPrefs()

    def test_parse(self):
        lib = self.lib
        lib.query_with_refresh("dummy search")
        songs = list(lib._contents.values())
        self.failUnlessEqual(len(songs), 1)
        s = songs[0]
        self.failUnlessEqual(s("artist"), "Kerstin Eden")
        self.failUnlessEqual(s("date"), "2015-03-02")
        self.failUnlessEqual(s("~#download_count"), 2062)
        self.failUnlessEqual(s("~#playback_count"), 23656)
        self.failUnlessEqual(s("~#favoritings_count"), 882)
        self.failUnlessEqual(s("~#rating"), 1.0)
        self.failUnlessEqual(s("~#playcount"), 4)
        assert int(s("~#bitrate")) == 319

    def test_artwork_url(self):
        lib = SoundcloudLibrary(self.FakeClient())
        lib.query_with_refresh("")
        s = list(lib._contents.values())[0]
        self.failUnlessEqual(
            s("artwork_url"),
            "https://i1.sndcdn.com/artworks-000108682375-q4j7y6-t500x500.jpg")
class TSoundcloudLibrary(TestCase):
    class FakeClient(SoundcloudApiClient):

        def get_tracks(self, query):
            self._on_track_data(None, [TRACK], None)

        def __init__(self, token=None):
            super(TSoundcloudLibrary.FakeClient, self).__init__(token)

        def authenticate_user(self):
            pass

    def setUp(self):
        SoundcloudLibrary.librarian = None
        self.lib = SoundcloudLibrary(self.FakeClient())

    def tearDown(self):
        self.lib.destroy()

    @classmethod
    def setUpClass(cls):
        config.RATINGS = config.HardCodedRatingsPrefs()

    def test_parse(self):
        lib = self.lib
        lib.query_with_refresh("dummy search")
        songs = lib._contents.values()
        self.failUnlessEqual(len(songs), 1)
        s = songs[0]
        self.failUnlessEqual(s("artist"), "Kerstin Eden")
        self.failUnlessEqual(s("date"), "2015-03-02")
        self.failUnlessEqual(s("~#download_count"), 2062)
        self.failUnlessEqual(s("~#playback_count"), 23656)
        self.failUnlessEqual(s("~#favoritings_count"), 882)
        self.failUnlessEqual(s("~#rating"), 1.0)
        self.failUnlessEqual(s("~#playcount"), 4)
        self.failUnlessAlmostEqual(s("~#bitrate"), 319)

    def test_artwork_url(self):
        lib = SoundcloudLibrary(self.FakeClient())
        lib.query_with_refresh("")
        s = lib._contents.values()[0]
        self.failUnlessEqual(
            s("artwork_url"),
            "https://i1.sndcdn.com/artworks-000108682375-q4j7y6-t500x500.jpg")
示例#6
0
 def test_artwork_url(self):
     lib = SoundcloudLibrary(self.FakeClient())
     lib.query_with_refresh("")
     s = list(lib._contents.values())[0]
     url = s("artwork_url")
     assert url == "https://i1.sndcdn.com/artworks-000121689963-0b0pdr-t500x500.jpg"
示例#7
0
 def setUp(self):
     SoundcloudLibrary.librarian = None
     self.lib = SoundcloudLibrary(self.FakeClient())
 def setUp(self):
     SoundcloudLibrary.librarian = None
     self.lib = SoundcloudLibrary(self.FakeClient())