diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_music.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_music.py b/tests/test_music.py index ccf0539..aadfcc5 100644 --- a/tests/test_music.py +++ b/tests/test_music.py @@ -53,6 +53,15 @@ class Music(unittest.TestCase): with self.assertRaises(music.ModuleError, msg=bad): m.actions["seek"](bad) + def test_volume_sets_the_sink(self): + calls = [] + m = music.make({"run": lambda *a, **k: "", "popen": calls.append}) + m.actions["volume"]({"level": 45}) + self.assertEqual(calls[0], ["wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "0.45"]) + for bad in ({}, {"level": 101}, {"level": -1}, {"level": "5"}, {"level": True}): + with self.assertRaises(music.ModuleError, msg=bad): + m.actions["volume"](bad) + if __name__ == "__main__": unittest.main() |
