tests: Make dummy backend use real playback provider if audio is passed in

This is needed in order to make audio events propagate, to core and trigger
async state changes in tests.
This commit is contained in:
Thomas Adamcik 2015-09-04 15:34:40 +02:00
parent d8986e6cc1
commit 7201f2cb10
3 changed files with 9 additions and 3 deletions

View File

@ -22,7 +22,10 @@ class DummyBackend(pykka.ThreadingActor, backend.Backend):
super(DummyBackend, self).__init__()
self.library = DummyLibraryProvider(backend=self)
self.playback = DummyPlaybackProvider(audio=audio, backend=self)
if audio:
self.playback = backend.PlaybackProvider(audio=audio, backend=self)
else:
self.playback = DummyPlaybackProvider(audio=audio, backend=self)
self.playlists = DummyPlaylistsProvider(backend=self)
self.uri_schemes = ['dummy']

View File

@ -10,7 +10,7 @@ from mopidy import core
from mopidy.internal import deprecation
from mopidy.mpd import session, uri_mapper
from tests import dummy_backend, dummy_mixer
from tests import dummy_audio, dummy_backend, dummy_mixer
class MockConnection(mock.Mock):
@ -44,11 +44,13 @@ class BaseTestCase(unittest.TestCase):
self.mixer = dummy_mixer.create_proxy()
else:
self.mixer = None
self.backend = dummy_backend.create_proxy()
self.audio = dummy_audio.create_proxy()
self.backend = dummy_backend.create_proxy(audio=self.audio)
with deprecation.ignore():
self.core = core.Core.start(
self.get_config(),
audio=self.audio,
mixer=self.mixer,
backends=[self.backend]).proxy()

View File

@ -31,6 +31,7 @@ class IssueGH17RegressionTest(protocol.BaseTestCase):
Track(uri='dummy:e'),
Track(uri='dummy:f'),
]
self.audio.trigger_fake_playback_failure('dummy:error')
self.backend.library.dummy_library = tracks
self.core.tracklist.add(uris=[t.uri for t in tracks]).get()