@@ -0,0 +1,1507 @@
+import threading%0Aimport unittest%0A%0Afrom pykka.actor import ThreadingActor%0Afrom pykka.registry import ActorRegistry%0A%0Afrom mopidy.backends.dummy import DummyBackend%0Afrom mopidy.listeners import BackendListener%0Afrom mopidy.models import Track%0A%0Aclass BackendEventsTest(unittest.TestCase):%0A    def setUp(self):%0A        self.events = %7B%0A            'started_playing': threading.Event(),%0A            'stopped_playing': threading.Event(),%0A        %7D%0A        self.backend = DummyBackend.start().proxy()%0A        self.listener = DummyBackendListener.start(self.events).proxy()%0A%0A    def tearDown(self):%0A        ActorRegistry.stop_all()%0A%0A    def test_play_sends_started_playing_event(self):%0A        self.backend.current_playlist.add(%5BTrack(uri='a')%5D)%0A        self.backend.playback.play()%0A        self.events%5B'started_playing'%5D.wait(timeout=1)%0A        self.assertTrue(self.events%5B'started_playing'%5D.is_set())%0A%0A    def test_stop_sends_stopped_playing_event(self):%0A        self.backend.current_playlist.add(%5BTrack(uri='a')%5D)%0A        self.backend.playback.play()%0A        self.backend.playback.stop()%0A        self.events%5B'stopped_playing'%5D.wait(timeout=1)%0A        self.assertTrue(self.events%5B'stopped_playing'%5D.is_set())%0A%0A%0Aclass DummyBackendListener(ThreadingActor, BackendListener):%0A    def __init__(self, events):%0A        self.events = events%0A%0A    def started_playing(self, track):%0A        self.events%5B'started_playing'%5D.set()%0A%0A    def stopped_playing(self, track, stop_position):%0A        self.events%5B'stopped_playing'%5D.set()%0A

Test that backend actually sends the events