core: Unbreak end of track related tests.

We should only be hooking up end of track when an audio instance is passed in.
Additionally the tracklist tests where wrongly sending in the audio module
instead of the mock audio.Audio instance.
This commit is contained in:
Thomas Adamcik 2013-01-05 23:32:35 +01:00
parent fb8fba243a
commit 3857eaa840
2 changed files with 5 additions and 4 deletions

View File

@ -46,9 +46,10 @@ class Core(pykka.ThreadingActor, AudioListener, BackendListener):
self.tracklist = TracklistController(core=self)
# Hook up blocking on end of track handler to audio sub-system.
audio.set_on_end_of_track(
lambda: self.actor_ref.proxy().playback.on_end_of_track().get())
if audio:
# Hook up blocking on end of track handler to audio sub-system.
audio.set_on_end_of_track(
lambda: self.actor_ref.proxy().playback.on_end_of_track().get())
def get_uri_schemes(self):
futures = [b.uri_schemes for b in self.backends]

View File

@ -18,7 +18,7 @@ class TracklistControllerTest(object):
def setUp(self):
self.audio = mock.Mock(spec=audio.Audio)
self.backend = self.backend_class.start(audio=self.audio).proxy()
self.core = core.Core(audio=audio, backends=[self.backend])
self.core = core.Core(audio=self.audio, backends=[self.backend])
self.controller = self.core.tracklist
self.playback = self.core.playback