mopidy-funkwhale/tests/conftest.py

50 lines
1.0 KiB
Python
Raw Permalink Normal View History

2018-10-04 20:57:27 +02:00
import pytest
import mopidy_funkwhale.actor
import mopidy_funkwhale.client
import mopidy_funkwhale.library
FUNKWHALE_URL = "https://test.funkwhale"
@pytest.fixture()
2019-05-03 12:22:45 +02:00
def config(tmpdir):
2018-10-04 20:57:27 +02:00
return {
2019-05-03 12:22:45 +02:00
"core": {"data_dir": str(tmpdir)},
2018-10-05 00:06:09 +02:00
"funkwhale": {
"url": FUNKWHALE_URL,
"username": "user",
"password": "passw0rd",
"cache_duration": 600,
2019-05-03 12:22:45 +02:00
"client_id": "",
"client_secret": "",
"verify_cert": "",
2018-10-05 00:06:09 +02:00
},
2018-10-04 20:57:27 +02:00
"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(
2019-05-03 12:22:45 +02:00
FUNKWHALE_URL,
{},
"test/something",
base_cls=mopidy_funkwhale.client.SessionWithUrlBase,
2018-10-04 20:57:27 +02:00
)
@pytest.fixture()
def client(backend, session):
return backend.client
@pytest.fixture
def library(backend):
return backend.library