mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
Sentry only loaded when diagnostics on (#3993)
* Sentry only loaded when diagnostics on * Logging when sentry is closed
This commit is contained in:
@@ -124,10 +124,25 @@ async def test_api_supervisor_options_diagnostics(
|
||||
await coresys.dbus.agent.connect(coresys.dbus.bus)
|
||||
dbus.clear()
|
||||
|
||||
response = await api_client.post("/supervisor/options", json={"diagnostics": True})
|
||||
await asyncio.sleep(0)
|
||||
with patch("supervisor.utils.sentry.sentry_sdk.init") as sentry_init:
|
||||
response = await api_client.post(
|
||||
"/supervisor/options", json={"diagnostics": True}
|
||||
)
|
||||
assert response.status == 200
|
||||
sentry_init.assert_called_once()
|
||||
|
||||
assert response.status == 200
|
||||
await asyncio.sleep(0)
|
||||
assert dbus == ["/io/hass/os-io.hass.os.Diagnostics"]
|
||||
|
||||
dbus.clear()
|
||||
with patch("supervisor.api.supervisor.close_sentry") as close_sentry:
|
||||
response = await api_client.post(
|
||||
"/supervisor/options", json={"diagnostics": False}
|
||||
)
|
||||
assert response.status == 200
|
||||
close_sentry.assert_called_once()
|
||||
|
||||
await asyncio.sleep(0)
|
||||
assert dbus == ["/io/hass/os-io.hass.os.Diagnostics"]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user