Exemplo n.º 1
0
    def testSearchArtist_All(self):
        """Test searching all artists in the music library."""
        request = tunes_db.SearchArtistsRequest()
        request.fetch_size = 3

        response = self.service.search_artists(request)
        response.check_initialized()

        self.assertEquals(3, len(response.artists))
        self.AssertArtistMatches(self.abba, response.artists[0])
        self.AssertArtistMatches(self.aem, response.artists[1])
        self.AssertArtistMatches(self.beatles, response.artists[2])

        request = tunes_db.SearchArtistsRequest()
        request.continuation = response.continuation
        request.fetch_size = 3
        response = self.service.search_artists(request)
        response.check_initialized()

        self.assertEquals(3, len(response.artists))
        self.AssertArtistMatches(self.furnaces, response.artists[0])
        self.AssertArtistMatches(self.go_team, response.artists[1])
        self.AssertArtistMatches(self.wendy_carlos, response.artists[2])

        request = tunes_db.SearchArtistsRequest()
        request.continuation = response.continuation
        response = self.service.search_artists(request)
        response.check_initialized()

        self.assertEquals([], response.artists)
Exemplo n.º 2
0
    def testSearchArtist_NothingFound(self):
        """Test the search_artists remote method when no artists are found."""
        request = tunes_db.SearchArtistsRequest()
        request.name_prefix = u'Duke'

        response = self.service.search_artists(request)
        response.check_initialized()
        self.assertFalse(hasattr(response, 'artist_count'))
Exemplo n.º 3
0
    def testSearchArtist_NamePrefix(self):
        """Test searching artists and matching by name prefix."""
        request = tunes_db.SearchArtistsRequest()
        request.name_prefix = u' { tHe!  '
        request.fetch_size = 2

        response = self.service.search_artists(request)
        response.check_initialized()

        self.assertEquals(2, len(response.artists))
        self.AssertArtistMatches(self.beatles, response.artists[0])
        self.AssertArtistMatches(self.furnaces, response.artists[1])

        request = tunes_db.SearchArtistsRequest()
        request.continuation = response.continuation

        response = self.service.search_artists(request)
        response.check_initialized()

        self.assertEquals(1, len(response.artists))
        self.assertEquals(None, response.continuation)
        self.AssertArtistMatches(self.go_team, response.artists[0])