diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-09 18:14:56 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-09 18:14:56 +0100 |
| commit | 8b677faf7c69edb355bb96f4beb040178bdece8b (patch) | |
| tree | 1395b22104d82bbd0d5e26b0e9630c5cc0ce1385 /tests/test_music.py | |
| parent | 9047e5420a59b43ef35ae95abb8264768761fcab (diff) | |
| download | deck-it-8b677faf7c69edb355bb96f4beb040178bdece8b.tar.gz deck-it-8b677faf7c69edb355bb96f4beb040178bdece8b.zip | |
feat: music module
Diffstat (limited to 'tests/test_music.py')
| -rw-r--r-- | tests/test_music.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_music.py b/tests/test_music.py new file mode 100644 index 0000000..675e72b --- /dev/null +++ b/tests/test_music.py @@ -0,0 +1,30 @@ +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) + +import unittest + +import deckit.modules.music as music + + +class Music(unittest.TestCase): + def test_parses_metadata(self): + sep = "\x1f" + fake = lambda cmd, timeout=2: { + "metadata": sep.join(["Playing", "Song", "Artist", "Album", "200000000", + "1000000", "", "spotify"]), + "get-volume": "Volume: 0.42", + }[cmd[1]] + m = music.make({"run": fake}) + st = m.state() + self.assertEqual(st["title"], "Song") + self.assertEqual(st["status"], "Playing") + self.assertEqual(st["volume"]["level"], 42) + + def test_action_commands(self): + self.assertEqual(music.BASE_ACTIONS["next"], ["playerctl", "next"]) + + +if __name__ == "__main__": + unittest.main() |
