def test_save_state(self): self.core.teardown() assert os.path.isfile(self.state_file) reload_data = storage.load(self.state_file) data = {} data['version'] = mopidy.__version__ data['state'] = models.CoreState( tracklist=models.TracklistState(repeat=False, random=False, consume=False, single=False, next_tlid=1), history=models.HistoryState(), playback=models.PlaybackState(state='stopped', time_position=0), mixer=models.MixerState()) assert data == reload_data
def test_load_state_with_data(self): data = {} data["version"] = mopidy.__version__ data["state"] = models.CoreState( tracklist=models.TracklistState( repeat=True, random=True, consume=False, single=False, tl_tracks=[models.TlTrack(tlid=12, track=Track(uri="a:a"))], next_tlid=14, ), history=models.HistoryState(history=[ models.HistoryTrack( timestamp=12, track=models.Ref.track(uri="a:a", name="a"), ), models.HistoryTrack( timestamp=13, track=models.Ref.track(uri="a:b", name="b"), ), ]), playback=models.PlaybackState(tlid=12, state="paused", time_position=432), mixer=models.MixerState(mute=True, volume=12), ) storage.dump(self.state_file, data) self.core._setup() assert self.core.mixer.get_mute() is True assert self.core.mixer.get_volume() == 12 assert self.core.tracklist._next_tlid == 14 assert self.core.tracklist.get_repeat() is True assert self.core.tracklist.get_random() is True assert self.core.tracklist.get_consume() is False assert self.core.tracklist.get_single() is False assert self.core.tracklist.get_length() == 1 assert self.core.playback._start_paused is True assert self.core.playback._start_at_position == 432 assert self.core.history.get_length() == 2
def test_save_state(self): self.core._teardown() assert self.state_file.is_file() reload_data = storage.load(self.state_file) data = {} data["version"] = mopidy.__version__ data["state"] = models.CoreState( tracklist=models.TracklistState( repeat=False, random=False, consume=False, single=False, next_tlid=1, ), history=models.HistoryState(), playback=models.PlaybackState(state="stopped", time_position=0), mixer=models.MixerState(), ) assert data == reload_data