Fixed some tests
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user