Skip to content

Commit

Permalink
fix: ruff lint
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Ortega <[email protected]>
  • Loading branch information
M0NsTeRRR committed Jan 10, 2025
1 parent f71190b commit 275adeb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/octodns_infomaniak/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, token):
session.headers.update(
{
"Authorization": f"Bearer {token}",
"User-Agent": f'octodns/{version("octodns")} octodns-infomaniak/{version(__package__)}',
"User-Agent": f"octodns/{version('octodns')} octodns-infomaniak/{version(__package__)}",
}
)
self._session = session
Expand Down
24 changes: 12 additions & 12 deletions tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ def test_http_error():

# 400
with responses.RequestsMock() as mock:
mock.get(f'{BASE_API_URL}zones/{zone_name.rstrip(".")}/records', status=400)
mock.get(f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records", status=400)

with pytest.raises(InfomaniakClientBadRequest):
zone = Zone(zone_name, [])
provider.populate(zone)

# 401
with responses.RequestsMock() as mock:
mock.get(f'{BASE_API_URL}zones/{zone_name.rstrip(".")}/records', status=401)
mock.get(f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records", status=401)

with pytest.raises(InfomaniakClientUnauthorized):
zone = Zone(zone_name, [])
provider.populate(zone)

# 403
with responses.RequestsMock() as mock:
mock.get(f'{BASE_API_URL}zones/{zone_name.rstrip(".")}/records', status=403)
mock.get(f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records", status=403)

with pytest.raises(InfomaniakClientForbidden):
zone = Zone(zone_name, [])
provider.populate(zone)

# 404
with responses.RequestsMock() as mock:
mock.get(f'{BASE_API_URL}zones/{zone_name.rstrip(".")}/records', status=404)
mock.get(f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records", status=404)

with pytest.raises(InfomaniakClientNotFound):
zone = Zone(zone_name, [])
Expand All @@ -63,11 +63,11 @@ def test_populate_empty_zone():
with responses.RequestsMock() as mock:
with open("tests/fixtures/empty_example.test.json") as f:
mock.get(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records",
status=200,
headers={
"Authorization": f"Bearer {TOKEN}",
"User-Agent": f'octodns/{version("octodns")} octodns-infomaniak/{version("octodns-infomaniak")}',
"User-Agent": f"octodns/{version('octodns')} octodns-infomaniak/{version('octodns-infomaniak')}",
},
json=json.loads(f.read()),
)
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_populate_zone():
with responses.RequestsMock() as mock:
with open("tests/fixtures/get_example.test.json") as f:
mock.get(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records",
status=200,
json=json.loads(f.read()),
)
Expand Down Expand Up @@ -423,7 +423,7 @@ def test_apply_full_zone():
with responses.RequestsMock() as mock:
with open("tests/fixtures/empty_example.test.json") as f:
mock.get(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records",
status=200,
json=json.loads(f.read()),
)
Expand All @@ -432,7 +432,7 @@ def test_apply_full_zone():
datas = json.loads(f.read())
for data in datas:
mock.post(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records",
status=201,
match=[matchers.json_params_matcher(data)],
json={},
Expand Down Expand Up @@ -488,7 +488,7 @@ def test_apply_update_zone():
with responses.RequestsMock() as mock:
with open("tests/fixtures/get_example2.test.json") as f:
mock.get(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records",
status=200,
json=json.loads(f.read()),
)
Expand All @@ -497,7 +497,7 @@ def test_apply_update_zone():
datas = json.loads(f.read())
for data in datas:
mock.post(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records",
status=201,
match=[matchers.json_params_matcher(data)],
json={},
Expand All @@ -507,7 +507,7 @@ def test_apply_update_zone():
datas = json.loads(f.read())
for data in datas:
mock.delete(
f"{BASE_API_URL}zones/{zone_name.rstrip(".")}/records/{data}",
f"{BASE_API_URL}zones/{zone_name.rstrip('.')}/records/{data}",
status=200,
json={},
)
Expand Down

0 comments on commit 275adeb

Please sign in to comment.