示例#1
0
    def test_repr(self):
        result = SearchResultItem.from_json(self.api_client_mock, self.ARTIST_JSON_DATA)
        expected = ("ArtistSearchResultItem(artist='artist_name_mock', likely_match=False, score=100, token='R0000000')")
        self.assertEqual(expected, repr(result))

        result = SearchResultItem.from_json(self.api_client_mock, self.COMPOSER_JSON_DATA)
        expected = ("ArtistSearchResultItem(artist='composer_name_mock', likely_match=False, score=100, token='C0000000')")
        self.assertEqual(expected, repr(result))
示例#2
0
    def test_repr(self):
        result = SearchResultItem.from_json(self.api_client_mock,
                                            self.ARTIST_JSON_DATA)
        expected = (
            "ArtistSearchResultItem(artist='artist_name_mock', likely_match=False, score=100, token='R0000000')"
        )
        self.assertEqual(expected, repr(result))

        result = SearchResultItem.from_json(self.api_client_mock,
                                            self.COMPOSER_JSON_DATA)
        expected = (
            "ArtistSearchResultItem(artist='composer_name_mock', likely_match=False, score=100, token='C0000000')"
        )
        self.assertEqual(expected, repr(result))
示例#3
0
 def test_repr(self):
     result = SearchResultItem.from_json(self.api_client_mock,
                                         self.GENRE_JSON_DATA)
     expected = (
         "GenreStationSearchResultItem(score=100, station_name='station_name_mock', token='G0000000')"
     )
     self.assertEqual(expected, repr(result))
示例#4
0
 def test_repr(self):
     result = SearchResultItem.from_json(self.api_client_mock,
                                         self.SONG_JSON_DATA)
     expected = (
         "SongSearchResultItem(artist='artist_name_mock', score=100, song_name='song_name_mock', token='S0000000')"
     )
     self.assertEqual(expected, repr(result))
示例#5
0
 def test_is_genre_station(self):
     result = SearchResultItem.from_json(self.api_client_mock,
                                         self.GENRE_JSON_DATA)
     assert not result.is_song
     assert not result.is_artist
     assert not result.is_composer
     assert result.is_genre_station
示例#6
0
    def test_create_station(self):
        result = SearchResultItem.from_json(self.api_client_mock,
                                            self.GENRE_JSON_DATA)
        result._api_client.create_station = Mock()

        result.create_station()
        result._api_client.create_station.assert_called_with(
            search_token=result.token)
示例#7
0
def search_item_mock():
    return SearchResultItem.from_json(
        get_backend(config()).api,
        search_result_mock()['genreStations'][0])
示例#8
0
def search_item_mock():
    return SearchResultItem.from_json(get_backend(
        config()).api, search_result_mock()['genreStations'][0])
示例#9
0
    def test_create_station(self):
        result = SearchResultItem.from_json(self.api_client_mock, self.GENRE_JSON_DATA)
        result._api_client.create_station = Mock()

        result.create_station()
        result._api_client.create_station.assert_called_with(search_token=result.token)
示例#10
0
 def test_repr(self):
     result = SearchResultItem.from_json(self.api_client_mock, self.GENRE_JSON_DATA)
     expected = ("GenreStationSearchResultItem(score=100, station_name='station_name_mock', token='G0000000')")
     self.assertEqual(expected, repr(result))
示例#11
0
 def test_repr(self):
     result = SearchResultItem.from_json(self.api_client_mock, self.SONG_JSON_DATA)
     expected = ("SongSearchResultItem(artist='artist_name_mock', score=100, song_name='song_name_mock', token='S0000000')")
     self.assertEqual(expected, repr(result))
示例#12
0
 def test_is_genre_station(self):
     result = SearchResultItem.from_json(self.api_client_mock, self.GENRE_JSON_DATA)
     assert not result.is_song
     assert not result.is_artist
     assert not result.is_composer
     assert result.is_genre_station