mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-23 00:56:29 +00:00
Make advanced logs error test work in all test environments (#5692)
When developing/testing in a Supervised environment, the systemd-journal-gatewayd socket is actually available. Mock the socket Path file to make the test independent of the pytest environment.
This commit is contained in:
parent
cf5a0dc548
commit
f4d69f1811
@ -358,11 +358,13 @@ async def test_advanced_logs_formatters(
|
|||||||
async def test_advanced_logs_errors(api_client: TestClient):
|
async def test_advanced_logs_errors(api_client: TestClient):
|
||||||
"""Test advanced logging API errors."""
|
"""Test advanced logging API errors."""
|
||||||
# coresys = coresys_logs_control
|
# coresys = coresys_logs_control
|
||||||
resp = await api_client.get("/host/logs")
|
with patch("supervisor.host.logs.SYSTEMD_JOURNAL_GATEWAYD_SOCKET") as socket:
|
||||||
assert resp.content_type == "text/plain"
|
socket.is_socket.return_value = False
|
||||||
assert resp.status == 400
|
resp = await api_client.get("/host/logs")
|
||||||
content = await resp.text()
|
assert resp.content_type == "text/plain"
|
||||||
assert content == "No systemd-journal-gatewayd Unix socket available"
|
assert resp.status == 400
|
||||||
|
content = await resp.text()
|
||||||
|
assert content == "No systemd-journal-gatewayd Unix socket available"
|
||||||
|
|
||||||
headers = {"Accept": "application/json"}
|
headers = {"Accept": "application/json"}
|
||||||
resp = await api_client.get("/host/logs", headers=headers)
|
resp = await api_client.get("/host/logs", headers=headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user