Adds icon endpoint to NO_AUTH (#30910)
* Adds icon endpoint to NO_AUTH * Add test for no_auth icon get * Blackoutpull/30924/head
parent
196bf2f3a0
commit
a5a69bdf71
|
@ -31,7 +31,9 @@ NO_TIMEOUT = re.compile(
|
|||
r")$"
|
||||
)
|
||||
|
||||
NO_AUTH = re.compile(r"^(?:" r"|app/.*" r"|addons/[^/]+/logo" r")$")
|
||||
NO_AUTH = re.compile(
|
||||
r"^(?:" r"|app/.*" r"|addons/[^/]+/logo" r"|addons/[^/]+/icon" r")$"
|
||||
)
|
||||
|
||||
|
||||
class HassIOView(HomeAssistantView):
|
||||
|
|
|
@ -60,7 +60,7 @@ async def test_forward_request_no_auth_for_panel(
|
|||
|
||||
|
||||
async def test_forward_request_no_auth_for_logo(hassio_client, aioclient_mock):
|
||||
"""Test no auth needed for ."""
|
||||
"""Test no auth needed for logo."""
|
||||
aioclient_mock.get("http://127.0.0.1/addons/bl_b392/logo", text="response")
|
||||
|
||||
resp = await hassio_client.get("/api/hassio/addons/bl_b392/logo")
|
||||
|
@ -74,6 +74,21 @@ async def test_forward_request_no_auth_for_logo(hassio_client, aioclient_mock):
|
|||
assert len(aioclient_mock.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_forward_request_no_auth_for_icon(hassio_client, aioclient_mock):
|
||||
"""Test no auth needed for icon."""
|
||||
aioclient_mock.get("http://127.0.0.1/addons/bl_b392/icon", text="response")
|
||||
|
||||
resp = await hassio_client.get("/api/hassio/addons/bl_b392/icon")
|
||||
|
||||
# Check we got right response
|
||||
assert resp.status == 200
|
||||
body = await resp.text()
|
||||
assert body == "response"
|
||||
|
||||
# Check we forwarded command
|
||||
assert len(aioclient_mock.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_forward_log_request(hassio_client, aioclient_mock):
|
||||
"""Test fetching normal log path doesn't remove ANSI color escape codes."""
|
||||
aioclient_mock.get("http://127.0.0.1/beer/logs", text="\033[32mresponse\033[0m")
|
||||
|
|
Loading…
Reference in New Issue