Esempio n. 1
0
def test_track_playback_ended_catches_pylast_error(pylast_mock, frontend):
    frontend.lastfm = mock.Mock(spec=pylast.LastFMNetwork)
    pylast_mock.NetworkError = pylast.NetworkError
    frontend.lastfm.scrobble.side_effect = pylast.NetworkError(None, "foo")
    track = models.Track(length=180432)
    tl_track = models.TlTrack(track=track, tlid=17)

    frontend.track_playback_ended(tl_track, 150000)
Esempio n. 2
0
def test_on_start_stops_actor_on_error(pylast_mock, frontend):
    pylast_mock.NetworkError = pylast.NetworkError
    pylast_mock.LastFMNetwork.side_effect = pylast.NetworkError(None, "foo")
    frontend.stop = mock.Mock()

    frontend.on_start()

    frontend.stop.assert_called_with()
Esempio n. 3
0
    def test_on_start_stops_actor_on_error(self, pylast_mock):
        pylast_mock.NetworkError = pylast.NetworkError
        pylast_mock.LastFMNetwork.side_effect = pylast.NetworkError(
            None, 'foo')
        self.frontend.stop = mock.Mock()

        self.frontend.on_start()

        self.frontend.stop.assert_called_with()
Esempio n. 4
0
def test_track_playback_started_catches_pylast_error(pylast_mock, frontend):
    frontend.lastfm = mock.Mock(spec=pylast.LastFMNetwork)
    pylast_mock.NetworkError = pylast.NetworkError
    frontend.lastfm.update_now_playing.side_effect = pylast.NetworkError(
        None, "foo")
    track = models.Track()
    tl_track = models.TlTrack(track=track, tlid=17)

    frontend.track_playback_started(tl_track)
    def test_track_playback_started_catches_pylast_error(self, pylast_mock):
        self.frontend.lastfm = mock.Mock(spec=pylast.LastFMNetwork)
        pylast_mock.NetworkError = pylast.NetworkError
        self.frontend.lastfm.update_now_playing.side_effect = (
            pylast.NetworkError(None, 'foo'))
        track = models.Track()
        tl_track = models.TlTrack(track=track, tlid=17)

        self.frontend.track_playback_started(tl_track)