Fix cors on the index view (#24283)

This commit is contained in:
Paulus Schoutsen 2019-06-03 11:43:13 -07:00 committed by GitHub
parent 4c88578371
commit 6f903db8c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -140,3 +140,15 @@ async def test_cors_middleware_with_cors_allowed_view(hass):
hass.http.app._on_startup.freeze()
await hass.http.app.startup()
async def test_cors_works_with_frontend(hass, hass_client):
"""Test CORS works with the frontend."""
assert await async_setup_component(hass, 'frontend', {
'http': {
'cors_allowed_origins': ['http://home-assistant.io']
}
})
client = await hass_client()
resp = await client.get('/')
assert resp.status == 200