Use f-strings in integrations starting with "A" (#32110)
* Use f-strings in integrations starting with A * Use f-strings in tests for integrations starting with A * Fix pylint by renaming variable * Fix nested for loop in f-string for aprs device_tracker * Break long lines into multiple short lines * Break long lines into multiple short lines v2
This commit is contained in:
1 parent
a85808e325
commit
524a1a7587
48 files changed
+162
-229
No files matched your search
@@ -28,7 +28,7 @@ async def test_login_new_user_and_trying_refresh_token(hass, aiohttp_client):
|
||||
step = await resp.json()
|
||||
|
||||
resp = await client.post(
|
||||
"/auth/login_flow/{}".format(step["flow_id"]),
|
||||
f"/auth/login_flow/{step['flow_id']}",
|
||||
json={"client_id": CLIENT_ID, "username": "test-user", "password": "test-pass"},
|
||||
)
|
||||
|
||||
@@ -71,7 +71,7 @@ async def test_login_new_user_and_trying_refresh_token(hass, aiohttp_client):
|
||||
assert resp.status == 401
|
||||
|
||||
resp = await client.get(
|
||||
"/api/", headers={"authorization": "Bearer {}".format(tokens["access_token"])}
|
||||
"/api/", headers={"authorization": f"Bearer {tokens['access_token']}"}
|
||||
)
|
||||
assert resp.status == 200
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ async def async_get_code(hass, aiohttp_client):
|
||||
step = await resp.json()
|
||||
|
||||
resp = await client.post(
|
||||
"/auth/login_flow/{}".format(step["flow_id"]),
|
||||
f"/auth/login_flow/{step['flow_id']}",
|
||||
json={"client_id": CLIENT_ID, "username": "2nd-user", "password": "2nd-pass"},
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ async def test_link_user(hass, aiohttp_client):
|
||||
resp = await client.post(
|
||||
"/auth/link_user",
|
||||
json={"client_id": CLIENT_ID, "code": code},
|
||||
headers={"authorization": "Bearer {}".format(info["access_token"])},
|
||||
headers={"authorization": f"Bearer {info['access_token']}"},
|
||||
)
|
||||
|
||||
assert resp.status == 200
|
||||
@@ -84,7 +84,7 @@ async def test_link_user_invalid_client_id(hass, aiohttp_client):
|
||||
resp = await client.post(
|
||||
"/auth/link_user",
|
||||
json={"client_id": "invalid", "code": code},
|
||||
headers={"authorization": "Bearer {}".format(info["access_token"])},
|
||||
headers={"authorization": f"Bearer {info['access_token']}"},
|
||||
)
|
||||
|
||||
assert resp.status == 400
|
||||
@@ -100,7 +100,7 @@ async def test_link_user_invalid_code(hass, aiohttp_client):
|
||||
resp = await client.post(
|
||||
"/auth/link_user",
|
||||
json={"client_id": CLIENT_ID, "code": "invalid"},
|
||||
headers={"authorization": "Bearer {}".format(info["access_token"])},
|
||||
headers={"authorization": f"Bearer {info['access_token']}"},
|
||||
)
|
||||
|
||||
assert resp.status == 400
|
||||
|
||||
@@ -54,7 +54,7 @@ async def test_invalid_username_password(hass, aiohttp_client):
|
||||
|
||||
# Incorrect username
|
||||
resp = await client.post(
|
||||
"/auth/login_flow/{}".format(step["flow_id"]),
|
||||
f"/auth/login_flow/{step['flow_id']}",
|
||||
json={
|
||||
"client_id": CLIENT_ID,
|
||||
"username": "wrong-user",
|
||||
@@ -70,7 +70,7 @@ async def test_invalid_username_password(hass, aiohttp_client):
|
||||
|
||||
# Incorrect password
|
||||
resp = await client.post(
|
||||
"/auth/login_flow/{}".format(step["flow_id"]),
|
||||
f"/auth/login_flow/{step['flow_id']}",
|
||||
json={
|
||||
"client_id": CLIENT_ID,
|
||||
"username": "test-user",
|
||||
@@ -105,7 +105,7 @@ async def test_login_exist_user(hass, aiohttp_client):
|
||||
step = await resp.json()
|
||||
|
||||
resp = await client.post(
|
||||
"/auth/login_flow/{}".format(step["flow_id"]),
|
||||
f"/auth/login_flow/{step['flow_id']}",
|
||||
json={"client_id": CLIENT_ID, "username": "test-user", "password": "test-pass"},
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user