test: add test suite for player, api and widgets
This commit is contained in:
1 parent
237de2efe9
commit
8eb22ea52c
11 files changed
+1069
No files matched your search
@@ -0,0 +1,28 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from somafm_tui.__main__ import _build_parser, _list_stations
|
||||
|
||||
|
||||
def test_parser_defaults_and_flags() -> None:
|
||||
parser = _build_parser()
|
||||
args = parser.parse_args([])
|
||||
assert args.autoplay is None
|
||||
assert args.offline is False
|
||||
assert args.no_audio is False
|
||||
|
||||
assert args.spectrum_source == "auto"
|
||||
|
||||
args = parser.parse_args(
|
||||
["--station", "defcon", "--play", "--no-mpris", "--spectrum-source", "monitor"]
|
||||
)
|
||||
assert args.station == "defcon"
|
||||
assert args.autoplay is True
|
||||
assert args.no_mpris is True
|
||||
assert args.spectrum_source == "monitor"
|
||||
|
||||
|
||||
def test_list_stations_offline(capsys) -> None:
|
||||
assert _list_stations(offline=True) == 0
|
||||
output = capsys.readouterr().out
|
||||
assert "groovesalad" in output
|
||||
assert "Groove Salad" in output
|
||||
Reference in new issue
Block a user