Fixed some tests
This commit is contained in:
@@ -61,6 +61,9 @@ class UIState:
|
|||||||
|
|
||||||
active_playlist_id: Optional[str] = None
|
active_playlist_id: Optional[str] = None
|
||||||
|
|
||||||
|
def migrate(self):
|
||||||
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_song(self) -> Optional[Child]:
|
def current_song(self) -> Optional[Child]:
|
||||||
if (not self.play_queue or self.current_song_index < 0
|
if (not self.play_queue or self.current_song_index < 0
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@@ -16,25 +17,27 @@ def test_config_default_cache_location():
|
|||||||
def test_server_property():
|
def test_server_property():
|
||||||
config = AppConfiguration()
|
config = AppConfiguration()
|
||||||
server = ServerConfiguration(
|
server = ServerConfiguration(
|
||||||
name='Test',
|
name='foo', server_address='bar', username='baz')
|
||||||
server_address='https://test.host',
|
|
||||||
username='test',
|
|
||||||
)
|
|
||||||
config.servers.append(server)
|
config.servers.append(server)
|
||||||
assert config.server is None
|
assert config.server is None
|
||||||
config.current_server = 0
|
config.current_server_index = 0
|
||||||
assert asdict(config.server) == asdict(server)
|
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():
|
def test_yaml_load_unload():
|
||||||
config = AppConfiguration()
|
config = AppConfiguration()
|
||||||
server = ServerConfiguration(
|
server = ServerConfiguration(
|
||||||
name='Test',
|
name='foo', server_address='bar', username='baz')
|
||||||
server_address='https://test.host',
|
|
||||||
username='test',
|
|
||||||
)
|
|
||||||
config.servers.append(server)
|
config.servers.append(server)
|
||||||
config.current_server = 0
|
config.current_server_index = 0
|
||||||
|
|
||||||
yamlified = yaml.dump(asdict(config))
|
yamlified = yaml.dump(asdict(config))
|
||||||
unyamlified = yaml.load(yamlified, Loader=yaml.CLoader)
|
unyamlified = yaml.load(yamlified, Loader=yaml.CLoader)
|
||||||
|
Reference in New Issue
Block a user