File: test_lookup.py

package info (click to toggle)
mopidy 3.4.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,696 kB
  • sloc: python: 16,669; sh: 159; makefile: 127
file content (31 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (2)
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
from unittest import mock

import pytest

from mopidy import exceptions
from mopidy.internal import path

from tests import path_to_data_dir


@pytest.mark.parametrize(
    "track_uri", [path.path_to_uri(path_to_data_dir("song1.wav"))]
)
def test_lookup(provider, track_uri):
    result = provider.lookup(track_uri)

    assert len(result) == 1
    track = result[0]
    assert track.uri == track_uri
    assert track.length == 4406
    assert track.name == "song1.wav"

    with mock.patch(
        "mopidy.file.library.tags.convert_tags_to_track",
        side_effect=exceptions.ScannerError("test"),
    ):
        result = provider.lookup(track_uri)
        assert len(result) == 1
        track = result[0]
        assert track.uri == track_uri
        assert track.name == "song1.wav"