def test_playing(self, twitter, track, song, lyric): spotify_mock = MagicMock() spotify_mock.get_current_track.return_value = track musixmatch_mock = MagicMock() song.lyric = lyric musixmatch_mock.fetch_lyric.return_value = song gorrion = Gorrion(spotify_mock, twitter, musixmatch_mock) tweet = gorrion.playing() assert tweet == PublishedTweet( id_='fake-status-id', tweet=('Now listening 🔊🎶:\n\n' 'Track: 1. Peligro\n' 'Album: Pa morirse de amor\n' 'Artist: Ely Guerra\n\n' '#gorrion #NowPlaying #ElyGuerra\n\n' 'http://spotify.com/track/1'), entity=Track(id_='1', name='Peligro', href='', public_url='http://spotify.com/track/1', track_number=1, album=Album( id_='11', name='Pa morirse de amor', href='', public_url='http://spotify.com/album/11', release_date='2006-01-01', total_tracks=19, ), artists=[ Artist( id_='12', name='Ely Guerra', href='', public_url='http://spotify.com/artist/12', ), ]))
def playing(self, chat_id: str, gorrion: Gorrion) -> None: song = gorrion.playing() self._bot.send_message(chat_id=chat_id, text=song.tweet)