From a6066da532c4feaffee19d3e878f3d3863e6ac68 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 6 Apr 2020 09:05:52 -0600 Subject: [PATCH] Fixed some tests --- sublime/ui/state.py | 3 +++ tests/config_test.py | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sublime/ui/state.py b/sublime/ui/state.py index 0bb9abe..73d5aa1 100644 --- a/sublime/ui/state.py +++ b/sublime/ui/state.py @@ -61,6 +61,9 @@ class UIState: active_playlist_id: Optional[str] = None + def migrate(self): + pass + @property def current_song(self) -> Optional[Child]: if (not self.play_queue or self.current_song_index < 0 diff --git a/tests/config_test.py b/tests/config_test.py index edfd476..73cea34 100644 --- a/tests/config_test.py +++ b/tests/config_test.py @@ -1,5 +1,6 @@ import os from dataclasses import asdict +from pathlib import Path import yaml @@ -16,25 +17,27 @@ def test_config_default_cache_location(): def test_server_property(): config = AppConfiguration() server = ServerConfiguration( - name='Test', - server_address='https://test.host', - username='test', - ) + name='foo', server_address='bar', username='baz') config.servers.append(server) assert config.server is None - config.current_server = 0 + config.current_server_index = 0 assert asdict(config.server) == asdict(server) + expected_state_file_location = Path('~/.local/share').expanduser() + expected_state_file_location = expected_state_file_location.joinpath( + 'sublime-music', + '6df23dc03f9b54cc38a0fc1483df6e21', + 'state.pickle', + ) + assert config.state_file_location == expected_state_file_location + def test_yaml_load_unload(): config = AppConfiguration() server = ServerConfiguration( - name='Test', - server_address='https://test.host', - username='test', - ) + name='foo', server_address='bar', username='baz') config.servers.append(server) - config.current_server = 0 + config.current_server_index = 0 yamlified = yaml.dump(asdict(config)) unyamlified = yaml.load(yamlified, Loader=yaml.CLoader)