mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Resolve and caches paths for CachingStaticResource in the executor (#74474)
This commit is contained in:
@@ -578,3 +578,35 @@ async def test_manifest_json(hass, frontend_themes, mock_http_client):
|
||||
|
||||
json = await resp.json()
|
||||
assert json["theme_color"] != DEFAULT_THEME_COLOR
|
||||
|
||||
|
||||
async def test_static_path_cache(hass, mock_http_client):
|
||||
"""Test static paths cache."""
|
||||
resp = await mock_http_client.get("/lovelace/default_view", allow_redirects=False)
|
||||
assert resp.status == 404
|
||||
|
||||
resp = await mock_http_client.get("/frontend_latest/", allow_redirects=False)
|
||||
assert resp.status == 403
|
||||
|
||||
resp = await mock_http_client.get(
|
||||
"/static/icons/favicon.ico", allow_redirects=False
|
||||
)
|
||||
assert resp.status == 200
|
||||
|
||||
# and again to make sure the cache works
|
||||
resp = await mock_http_client.get(
|
||||
"/static/icons/favicon.ico", allow_redirects=False
|
||||
)
|
||||
assert resp.status == 200
|
||||
|
||||
resp = await mock_http_client.get(
|
||||
"/static/fonts/roboto/Roboto-Bold.woff2", allow_redirects=False
|
||||
)
|
||||
assert resp.status == 200
|
||||
|
||||
resp = await mock_http_client.get("/static/does-not-exist", allow_redirects=False)
|
||||
assert resp.status == 404
|
||||
|
||||
# and again to make sure the cache works
|
||||
resp = await mock_http_client.get("/static/does-not-exist", allow_redirects=False)
|
||||
assert resp.status == 404
|
||||
|
||||
Reference in New Issue
Block a user