diff options
-rw-r--r-- | notifier_unittest.py | 22 |
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 |