From 8b677faf7c69edb355bb96f4beb040178bdece8b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 9 Nov 2026 18:14:56 +0100 Subject: feat: music module --- tests/test_music.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/test_music.py (limited to 'tests') 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() -- cgit v1.2.3