conftest.py 1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
import pytest

import mopidy_funkwhale.actor
import mopidy_funkwhale.client
import mopidy_funkwhale.library

FUNKWHALE_URL = "https://test.funkwhale"


@pytest.fixture()
Eliot Berriot's avatar
Eliot Berriot committed
11
def config(tmpdir):
12
    return {
Eliot Berriot's avatar
Eliot Berriot committed
13
        "core": {"data_dir": str(tmpdir)},
14
15
16
17
18
        "funkwhale": {
            "url": FUNKWHALE_URL,
            "username": "user",
            "password": "passw0rd",
            "cache_duration": 600,
Eliot Berriot's avatar
Eliot Berriot committed
19
20
21
            "client_id": "",
            "client_secret": "",
            "verify_cert": "",
22
        },
23
24
25
26
27
28
29
30
31
32
33
34
        "proxy": {},
    }


@pytest.fixture
def backend(config):
    return mopidy_funkwhale.actor.FunkwhaleBackend(config=config, audio=None)


@pytest.fixture()
def session(backend):
    return mopidy_funkwhale.client.get_requests_session(
Eliot Berriot's avatar
Eliot Berriot committed
35
36
37
38
        FUNKWHALE_URL,
        {},
        "test/something",
        base_cls=mopidy_funkwhale.client.SessionWithUrlBase,
39
40
41
42
43
44
45
46
47
48
49
    )


@pytest.fixture()
def client(backend, session):
    return backend.client


@pytest.fixture
def library(backend):
    return backend.library