aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-04 14:00:01 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-04 14:01:29 +0100
commitc75f1ef702b1a3b5cdbbe7f1a87e0f0fbfa80e39 (patch)
tree0e965d9823565dcbcc364547922dc4283a10a597
parentedb2ffc66231702c931429ab44ad5009abb8c128 (diff)
Refactored notifier unit tests
-rw-r--r--notifier_unittest.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/notifier_unittest.py b/notifier_unittest.py
index 52be51e..79b2787 100644
--- a/notifier_unittest.py
+++ b/notifier_unittest.py
@@ -37,17 +37,21 @@ def test_eventWithoutRegisteredCallbacks(uut):
uut.notify(Notifier.PLAYING_STATE_EVENT)
# expect no crash
-def test_playingStateEventWithMockPlayer(uut, mockPlayer):
- called = False
- def callback():
- nonlocal called
- called = True
+def test_eventsWithMockPlayer(uut, mockPlayer):
+ def testEvent(eventCode, simulateEvent):
+ called = False
+ def callback():
+ nonlocal called
+ called = True
- uut.registerCallback(Notifier.PLAYING_STATE_EVENT, callback)
+ uut.registerCallback(eventCode, callback)
- assert not called
- mockPlayer.simulatePlayingStateChanged()
- assert called
+ assert not called
+ simulateEvent()
+ assert called
+
+ testEvent(Notifier.PLAYING_STATE_EVENT, mockPlayer.simulatePlayingStateChanged)
+ #testEvent(Notifier.PLAYBACK_VOLUME_EVENT, mockPlayer.simulatePlaybackVolumeChanged)
def test_singleEventNotification(uut):
playingStateCalled = False