Allow CORS requests to token endpoint (#15519)
* Allow CORS requests to token endpoint * Tests * Fuck emulated hue * Clean up * Only cors existing methods
This commit is contained in:
1 parent
ca0d4226aa
commit
2fc0d83085
9 files changed
+59
-23
No files matched your search
@@ -19,14 +19,14 @@ from homeassistant.components.http.cors import setup_cors
|
||||
TRUSTED_ORIGIN = 'https://home-assistant.io'
|
||||
|
||||
|
||||
async def test_cors_middleware_not_loaded_by_default(hass):
|
||||
async def test_cors_middleware_loaded_by_default(hass):
|
||||
"""Test accessing to server from banned IP when feature is off."""
|
||||
with patch('homeassistant.components.http.setup_cors') as mock_setup:
|
||||
await async_setup_component(hass, 'http', {
|
||||
'http': {}
|
||||
})
|
||||
|
||||
assert len(mock_setup.mock_calls) == 0
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_cors_middleware_loaded_from_config(hass):
|
||||
|
||||
@@ -23,7 +23,7 @@ async def get_client(aiohttp_client, validator):
|
||||
"""Test method."""
|
||||
return b''
|
||||
|
||||
TestView().register(app.router)
|
||||
TestView().register(app, app.router)
|
||||
client = await aiohttp_client(app)
|
||||
return client
|
||||
|
||||
|
||||
Reference in new issue
Block a user