/
test_events.py
38 lines (28 loc) · 1.05 KB
/
test_events.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from __future__ import absolute_import, unicode_literals
import unittest
import mock
import pykka
from mopidy import backend, core
from mopidy.local import actor
from tests import dummy_audio, path_to_data_dir
@mock.patch.object(backend.BackendListener, 'send')
class LocalBackendEventsTest(unittest.TestCase):
config = {
'local': {
'media_dir': path_to_data_dir(''),
'data_dir': path_to_data_dir(''),
'playlists_dir': b'',
'library': 'json',
}
}
def setUp(self): # noqa: N802
self.audio = dummy_audio.create_proxy()
self.backend = actor.LocalBackend.start(
config=self.config, audio=self.audio).proxy()
self.core = core.Core.start(backends=[self.backend]).proxy()
def tearDown(self): # noqa: N802
pykka.ActorRegistry.stop_all()
def test_playlists_refresh_sends_playlists_loaded_event(self, send):
send.reset_mock()
self.core.playlists.refresh().get()
self.assertEqual(send.call_args[0][0], 'playlists_loaded')