def test_save(self): tl_tracks = self.core.tracklist.get_tl_tracks() self.core.playback.play(tl_tracks[1]) self.replay_events() state = PlaybackState( time_position=0, state='playing', tlid=tl_tracks[1].tlid) value = self.core.playback._save_state() self.assertEqual(state, value)
def test_load_not_covered(self): tl_tracks = self.core.tracklist.get_tl_tracks() self.core.playback.stop() self.replay_events() self.assertEqual('stopped', self.core.playback.get_state()) state = PlaybackState(time_position=0, state='playing', tlid=tl_tracks[2].tlid) coverage = ['other'] self.core.playback._load_state(state, coverage) self.replay_events() self.assertEqual('stopped', self.core.playback.get_state()) self.assertEqual(None, self.core.playback.get_current_tl_track())
def test_load_not_covered(self): tl_tracks = self.core.tracklist.get_tl_tracks() self.core.playback.stop() self.replay_events() assert "stopped" == self.core.playback.get_state() state = PlaybackState(time_position=0, state="playing", tlid=tl_tracks[2].tlid) coverage = ["other"] self.core.playback._load_state(state, coverage) self.replay_events() assert "stopped" == self.core.playback.get_state() assert self.core.playback.get_current_tl_track() is None
def test_position(self): time_position = 123456 result = PlaybackState(time_position=time_position) self.assertEqual(result.time_position, time_position) with self.assertRaises(AttributeError): result.time_position = None
def test_state(self): state = 'playing' result = PlaybackState(state=state) self.assertEqual(result.state, state) with self.assertRaises(AttributeError): result.state = None
def test_tl_track_none(self): tlid = None result = PlaybackState(tlid=tlid) self.assertEqual(result.tlid, tlid) with self.assertRaises(AttributeError): result.tl_track = None