mirror of
https://github.com/jellyfin/mopidy-jellyfin.git
synced 2024-11-30 09:00:53 +00:00
tests for browsing
This commit is contained in:
parent
7235d2341c
commit
5a7ab4f236
@ -1,3 +1,5 @@
|
||||
import mock
|
||||
|
||||
import pytest
|
||||
|
||||
import mopidy_emby
|
||||
@ -27,3 +29,19 @@ def emby_client(config, mocker):
|
||||
mocker.patch('mopidy_emby.backend.EmbyHandler._password_data')
|
||||
|
||||
return mopidy_emby.backend.EmbyHandler(config)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def backend_mock():
|
||||
backend_mock = mock.Mock(autospec=mopidy_emby.backend.EmbyBackend)
|
||||
backend_mock.remote(autospec=mopidy_emby.backend.EmbyHandler)
|
||||
backend_mock.remote.get_artists.return_value = ['Artistlist']
|
||||
backend_mock.remote.get_albums.return_value = ['Albumlist']
|
||||
backend_mock.remote.get_tracks.return_value = ['Tracklist']
|
||||
|
||||
return backend_mock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def provider(backend_mock):
|
||||
return mopidy_emby.backend.EmbyLibraryProvider(backend_mock)
|
||||
|
@ -206,3 +206,12 @@ def test_create_artists(data, expected, emby_client):
|
||||
track = json.load(f)
|
||||
|
||||
assert emby_client.create_artists(track) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize('uri,expected', [
|
||||
('emby:', ['Artistlist']),
|
||||
('emby:artist:123', ['Albumlist']),
|
||||
('emby:album:123', ['Tracklist']),
|
||||
])
|
||||
def test_browse(uri, expected, provider):
|
||||
assert provider.browse(uri) == expected
|
||||
|
Loading…
Reference in New Issue
Block a user