2022-02-22 18:19:16 +01:00
|
|
|
from pathlib import Path
|
|
|
|
|
2021-06-30 18:41:14 +02:00
|
|
|
import pytest
|
2021-10-17 16:24:37 +02:00
|
|
|
|
2022-07-22 13:27:16 +02:00
|
|
|
from libretime_api_client.v2 import ApiClient
|
2021-06-30 18:41:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture()
|
2022-02-22 18:19:16 +01:00
|
|
|
def config_filepath(tmp_path: Path):
|
2022-06-06 17:09:25 +02:00
|
|
|
filepath = tmp_path / "config.yml"
|
2022-02-22 18:19:16 +01:00
|
|
|
filepath.write_text(
|
|
|
|
"""
|
2022-06-06 17:04:26 +02:00
|
|
|
general:
|
|
|
|
public_url: http://localhost/test
|
|
|
|
api_key: TEST_KEY
|
2022-02-22 18:19:16 +01:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
return filepath
|
2021-06-30 18:41:14 +02:00
|
|
|
|
|
|
|
|
2022-06-24 16:42:46 +02:00
|
|
|
def test_api_client(config_filepath):
|
2022-07-22 13:27:16 +02:00
|
|
|
client = ApiClient(config_path=config_filepath)
|
2022-06-24 16:42:46 +02:00
|
|
|
assert callable(client.services.version_url)
|
|
|
|
assert callable(client.services.schedule_url)
|
|
|
|
assert callable(client.services.webstream_url)
|
|
|
|
assert callable(client.services.show_instance_url)
|
|
|
|
assert callable(client.services.show_url)
|
|
|
|
assert callable(client.services.file_url)
|
|
|
|
assert callable(client.services.file_download_url)
|