Exemple #1
0
    def test_offsite_url_property(self):
        band_id = 3463798201

        api = bandcamp.TestApi('test_single_band')
        band = bandcamp.band.info(api=api, band_id=band_id)

        self.assertEqual('http://www.amandapalmer.net', band.offsite_url)
Exemple #2
0
    def test_artist_property(self):
        album_id = 927252583

        api = bandcamp.TestApi('test_album_tpwg')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual('Renard', album.artist)
Exemple #3
0
    def test_band_id_property(self):
        track_id = 2846277250

        api = bandcamp.TestApi('test_unicode_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertEqual(4180852708, track.band_id)
Exemple #4
0
    def test_band_id_property(self):
        album_id = 2587417518

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual(3463798201, album.band_id)
Exemple #5
0
    def test_subdomain_property(self):
        band_id = 3463798201

        api = bandcamp.TestApi('test_single_band')
        band = bandcamp.band.info(api=api, band_id=band_id)

        self.assertEqual('amandapalmer', band.subdomain)
Exemple #6
0
    def test_album_url(self):
        url = 'lapfoxtrax.com/album/--2'
        api = bandcamp.TestApi('test_album_url')

        response = bandcamp.url.info(api=api, url=url)
        self.assertEqual(4180852708, response.band_id)
        self.assertEqual(1163674320, response.album_id)
Exemple #7
0
    def test_url_property(self):
        track_id = 2846277250

        api = bandcamp.TestApi('test_unicode_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertEqual('/track/--2', track.url)
Exemple #8
0
    def test_search_more_than_twelve(self):
        """Verify that we raise an error when you try to search for more than 12 names"""
        name = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']

        api = bandcamp.TestApi('test_search_thirteen')
        with self.assertRaises(ValueError):
            bandcamp.band.search(api=api, name=name)
Exemple #9
0
    def test_title_property(self):
        album_id = 2587417518

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual('Who Killed Amanda Palmer', album.title)
Exemple #10
0
    def test_url_property(self):
        band_id = 3463798201

        api = bandcamp.TestApi('test_single_band')
        band = bandcamp.band.info(api=api, band_id=band_id)

        self.assertEqual('http://amandapalmer.bandcamp.com', band.url)
Exemple #11
0
    def test_search_twelve(self):
        """Verify that we can search for 12 names"""
        name = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']

        api = bandcamp.TestApi('test_search_twelve')
        bands = bandcamp.band.search(api=api, name=name)

        self.assertEqual(96, len(bands))
Exemple #12
0
    def test_search_multiple(self):
        """Verify that we can search for multiple names"""
        name = ['lapfox', 'aviators']

        api = bandcamp.TestApi('test_search_multiple')
        bands = bandcamp.band.search(api=api, name=name)

        self.assertEqual(8, len(bands))
Exemple #13
0
    def test_search_with_no_results(self):
        """Verify that we can handle a search that returns no results"""
        name = 'unittest'

        api = bandcamp.TestApi('test_search_unittest')
        bands = bandcamp.band.search(api=api, name=name)

        self.assertEqual({}, bands)
Exemple #14
0
    def test_large_art_url_property(self):
        album_id = 2587417518

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual('http://f0.bcbits.com/img/a1968148812_2.jpg',
                         album.large_art_url)
Exemple #15
0
    def test_unicode(self):
        """Verify that we can handle a unicode title"""
        track_id = 2846277250

        api = bandcamp.TestApi('test_unicode_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertEqual('\u266b \u2160\uff0f \u2764\u2764\u2764', track.title)
Exemple #16
0
    def test_unknown_property_is_none(self):
        """Verify that a property that was not in the response is None"""
        track_id = 1269403107

        api = bandcamp.TestApi('test_single_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertIsNone(track.large_art_url)
Exemple #17
0
    def test_large_art_url_property(self):
        band_id = 203035041

        api = bandcamp.TestApi('test_single_discography')
        discography = bandcamp.band.discography(api=api, band_id=band_id)

        album = discography.albums[4246425639]

        self.assertEqual('http://f0.bcbits.com/img/a0897080833_2.jpg', album.large_art_url)
Exemple #18
0
    def test_downloadable_property(self):
        """Verify that the downloadable property returns a enum member"""
        track_id = 1269403107

        api = bandcamp.TestApi('test_single_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertEqual(bandcamp.track.DownloadableStates.PAID,
                         track.downloadable)
Exemple #19
0
    def test_credits_property(self):
        album_id = 2587417518

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual(
            'For a complete list of credits, please visit http://www.whokilledamandapalmer.com/credits.php',
            album.credits)
Exemple #20
0
    def test_about_property(self):
        album_id = 2587417518

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual(
            'For additional information including a recording-diary by Amanda, exclusive videos, liner notes, lyrics, and much more, please visit http://www.whokilledamandapalmer.com',
            album.about)
Exemple #21
0
    def test_single_album(self):
        """Verify that a single album can be fetched"""
        album_id = 2587417518

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertIsInstance(album, bandcamp.album.Album)
        self.assertEqual(album_id, album.album_id)
Exemple #22
0
    def test_url_property(self):
        album_id = 927252583

        api = bandcamp.TestApi('test_album')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertEqual(
            'http://amandapalmer.bandcamp.com/album/who-killed-amanda-palmer?pk=564',
            album.url)
Exemple #23
0
    def test_band_track_url(self):
        url = 'http://music.sufjan.com/track/enchanting-ghost'
        api = bandcamp.TestApi('test_band_track_url')

        response = bandcamp.url.info(api=api, url=url)

        self.assertEqual(203035041, response.band_id)
        self.assertEqual(2323108455, response.track_id)
        self.assertIsNone(response.album_id)
Exemple #24
0
    def test_search_with_one_result(self):
        """Verify that we can handle a search that returns a single band"""
        name = 'Mumble'

        api = bandcamp.TestApi('test_search_mumble')
        band = bandcamp.band.search(api=api, name=name)

        self.assertIsInstance(band, bandcamp.band.Band)
        self.assertEqual(name, band.name)
Exemple #25
0
    def test_about_property(self):
        track_id = 1269403107

        api = bandcamp.TestApi('test_single_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertEqual(
            'Recorded live in Prague, Czech Republic at Palác Akropolis on May 5th, 2010',
            track.about)
Exemple #26
0
    def test_band_url(self):
        url = 'cults.bandcamp.com'
        api = bandcamp.TestApi('test_band_url')

        response = bandcamp.url.info(api=api, url=url)

        self.assertEqual(4214473200, response.band_id)
        self.assertIsNone(response.album_id)
        self.assertIsNone(response.track_id)
Exemple #27
0
    def test_single_track_int(self):
        """Verify that a single track can be fetched with its track id as a number"""
        track_id = 1269403107

        api = bandcamp.TestApi('test_single_track')
        track = bandcamp.track.info(api=api, track_id=track_id)

        self.assertIsInstance(track, bandcamp.track.Track)
        self.assertEqual(track_id, track.track_id)
Exemple #28
0
    def test_release_date(self):
        """Verify that the release_date returns a time_struct"""
        album_id = 2587417518

        # tpwg stands for "This Place Will Grow" which is the album title ;)
        api = bandcamp.TestApi('test_album_tpwg')
        album = bandcamp.album.info(api=api, album_id=album_id)

        self.assertIsInstance(album.release_date, time.struct_time)
Exemple #29
0
    def test_credits_property(self):
        band_id = 203035041

        api = bandcamp.TestApi('test_single_discography')
        discography = bandcamp.band.discography(api=api, band_id=band_id)

        album = discography.albums[4246425639]

        self.assertFalse(hasattr(album, 'credits'))
Exemple #30
0
    def test_album_id_property(self):
        band_id = 203035041

        api = bandcamp.TestApi('test_single_discography')
        discography = bandcamp.band.discography(api=api, band_id=band_id)

        album = discography.albums[4246425639]

        self.assertEqual(4246425639, album.album_id)