chore: rename api_client to api-client (#1727)

This commit is contained in:
Jonas L 2022-04-04 10:25:38 +02:00 committed by GitHub
parent e623c1f0df
commit fef38fb131
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 6 additions and 6 deletions

View file

@ -1,33 +0,0 @@
import pytest
from libretime_api_client.utils import ApcUrl, IncompleteUrl, UrlBadParam
@pytest.mark.parametrize(
"url, params, expected",
[
("one/two/three", {}, "one/two/three"),
("/testing/{key}", {"key": "aaa"}, "/testing/aaa"),
(
"/more/{key_a}/{key_b}/testing",
{"key_a": "aaa", "key_b": "bbb"},
"/more/aaa/bbb/testing",
),
],
)
def test_apc_url(url: str, params: dict, expected: str):
found = ApcUrl(url)
assert found.base_url == url
assert found.params(**params).url() == expected
def test_apc_url_bad_param():
url = ApcUrl("/testing/{key}")
with pytest.raises(UrlBadParam):
url.params(bad_key="testing")
def test_apc_url_incomplete():
url = ApcUrl("/{one}/{two}/three").params(two="testing")
with pytest.raises(IncompleteUrl):
url.url()