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))
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))
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))
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))
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
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)
def search_item_mock(): return SearchResultItem.from_json( get_backend(config()).api, search_result_mock()['genreStations'][0])
def search_item_mock(): return SearchResultItem.from_json(get_backend( config()).api, search_result_mock()['genreStations'][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)
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))
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))