2022-07-22 13:27:16 +02:00
|
|
|
from libretime_api_client.v2 import ApiClient
|
2021-06-30 18:41:14 +02:00
|
|
|
|
|
|
|
|
2022-07-20 16:33:03 +02:00
|
|
|
def test_api_client(requests_mock):
|
|
|
|
api_client = ApiClient(base_url="http://localhost:8080", api_key="test-key")
|
2021-06-30 18:41:14 +02:00
|
|
|
|
2022-07-20 16:33:03 +02:00
|
|
|
requests_mock.get(
|
|
|
|
"http://localhost:8080/api/v2/version",
|
|
|
|
json={"api_version": "2.0.0"},
|
|
|
|
)
|
2021-06-30 18:41:14 +02:00
|
|
|
|
2022-07-20 16:33:03 +02:00
|
|
|
resp = api_client.get_version()
|
|
|
|
assert resp.json() == {"api_version": "2.0.0"}
|