mpd: Use DummyMixer in tests
This commit is contained in:
parent
886c2b92d8
commit
160afbcd26
@ -2,6 +2,8 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import logging
|
||||
|
||||
import pykka
|
||||
|
||||
from mopidy import listener
|
||||
|
||||
|
||||
@ -147,3 +149,23 @@ class MixerListener(listener.Listener):
|
||||
:type mute: bool
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class DummyMixer(pykka.ThreadingActor, Mixer):
|
||||
|
||||
def __init__(self):
|
||||
super(DummyMixer, self).__init__()
|
||||
self._volume = None
|
||||
self._mute = None
|
||||
|
||||
def get_volume(self):
|
||||
return self._volume
|
||||
|
||||
def set_volume(self, volume):
|
||||
self._volume = volume
|
||||
|
||||
def get_mute(self):
|
||||
return self._mute
|
||||
|
||||
def set_mute(self, mute):
|
||||
self._mute = mute
|
||||
|
||||
@ -6,7 +6,7 @@ import mock
|
||||
|
||||
import pykka
|
||||
|
||||
from mopidy import core
|
||||
from mopidy import core, mixer
|
||||
from mopidy.backend import dummy
|
||||
from mopidy.mpd import session, uri_mapper
|
||||
|
||||
@ -32,8 +32,10 @@ class BaseTestCase(unittest.TestCase):
|
||||
}
|
||||
|
||||
def setUp(self): # noqa: N802
|
||||
self.mixer = mixer.DummyMixer.start().proxy()
|
||||
self.backend = dummy.create_dummy_backend_proxy()
|
||||
self.core = core.Core.start(backends=[self.backend]).proxy()
|
||||
self.core = core.Core.start(
|
||||
mixer=self.mixer, backends=[self.backend]).proxy()
|
||||
|
||||
self.uri_map = uri_mapper.MpdUriMapper(self.core)
|
||||
self.connection = MockConnection()
|
||||
|
||||
@ -4,7 +4,7 @@ import unittest
|
||||
|
||||
import pykka
|
||||
|
||||
from mopidy import core
|
||||
from mopidy import core, mixer
|
||||
from mopidy.backend import dummy
|
||||
from mopidy.core import PlaybackState
|
||||
from mopidy.models import Track
|
||||
@ -21,8 +21,10 @@ STOPPED = PlaybackState.STOPPED
|
||||
|
||||
class StatusHandlerTest(unittest.TestCase):
|
||||
def setUp(self): # noqa: N802
|
||||
self.mixer = mixer.DummyMixer.start().proxy()
|
||||
self.backend = dummy.create_dummy_backend_proxy()
|
||||
self.core = core.Core.start(backends=[self.backend]).proxy()
|
||||
self.core = core.Core.start(
|
||||
mixer=self.mixer, backends=[self.backend]).proxy()
|
||||
self.dispatcher = dispatcher.MpdDispatcher(core=self.core)
|
||||
self.context = self.dispatcher.context
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user