mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix deprecated code (#14681)
This commit is contained in:
parent
7d2563eb1f
commit
e746b92e0e
@ -185,7 +185,7 @@ class CloudIoT:
|
|||||||
yield from client.send_json(response)
|
yield from client.send_json(response)
|
||||||
|
|
||||||
except client_exceptions.WSServerHandshakeError as err:
|
except client_exceptions.WSServerHandshakeError as err:
|
||||||
if err.code == 401:
|
if err.status == 401:
|
||||||
disconnect_warn = 'Invalid auth.'
|
disconnect_warn = 'Invalid auth.'
|
||||||
self.close_requested = True
|
self.close_requested = True
|
||||||
# Should we notify user?
|
# Should we notify user?
|
||||||
|
@ -210,7 +210,7 @@ def test_cloud_connect_invalid_auth(mock_client, caplog, mock_cloud):
|
|||||||
"""Test invalid auth detected by server."""
|
"""Test invalid auth detected by server."""
|
||||||
conn = iot.CloudIoT(mock_cloud)
|
conn = iot.CloudIoT(mock_cloud)
|
||||||
mock_client.receive.side_effect = \
|
mock_client.receive.side_effect = \
|
||||||
client_exceptions.WSServerHandshakeError(None, None, code=401)
|
client_exceptions.WSServerHandshakeError(None, None, status=401)
|
||||||
|
|
||||||
yield from conn.connect()
|
yield from conn.connect()
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ async def test_register_before_setup(hass):
|
|||||||
assert intent.text_input == 'I would like the Grolsch beer'
|
assert intent.text_input == 'I would like the Grolsch beer'
|
||||||
|
|
||||||
|
|
||||||
async def test_http_processing_intent(hass, test_client):
|
async def test_http_processing_intent(hass, aiohttp_client):
|
||||||
"""Test processing intent via HTTP API."""
|
"""Test processing intent via HTTP API."""
|
||||||
class TestIntentHandler(intent.IntentHandler):
|
class TestIntentHandler(intent.IntentHandler):
|
||||||
"""Test Intent Handler."""
|
"""Test Intent Handler."""
|
||||||
@ -119,7 +119,7 @@ async def test_http_processing_intent(hass, test_client):
|
|||||||
})
|
})
|
||||||
assert result
|
assert result
|
||||||
|
|
||||||
client = await test_client(hass.http.app)
|
client = await aiohttp_client(hass.http.app)
|
||||||
resp = await client.post('/api/conversation/process', json={
|
resp = await client.post('/api/conversation/process', json={
|
||||||
'text': 'I would like the Grolsch beer'
|
'text': 'I would like the Grolsch beer'
|
||||||
})
|
})
|
||||||
@ -243,7 +243,7 @@ async def test_toggle_intent(hass, sentence):
|
|||||||
assert call.data == {'entity_id': 'light.kitchen'}
|
assert call.data == {'entity_id': 'light.kitchen'}
|
||||||
|
|
||||||
|
|
||||||
async def test_http_api(hass, test_client):
|
async def test_http_api(hass, aiohttp_client):
|
||||||
"""Test the HTTP conversation API."""
|
"""Test the HTTP conversation API."""
|
||||||
result = await component.async_setup(hass, {})
|
result = await component.async_setup(hass, {})
|
||||||
assert result
|
assert result
|
||||||
@ -251,7 +251,7 @@ async def test_http_api(hass, test_client):
|
|||||||
result = await async_setup_component(hass, 'conversation', {})
|
result = await async_setup_component(hass, 'conversation', {})
|
||||||
assert result
|
assert result
|
||||||
|
|
||||||
client = await test_client(hass.http.app)
|
client = await aiohttp_client(hass.http.app)
|
||||||
hass.states.async_set('light.kitchen', 'off')
|
hass.states.async_set('light.kitchen', 'off')
|
||||||
calls = async_mock_service(hass, 'homeassistant', 'turn_on')
|
calls = async_mock_service(hass, 'homeassistant', 'turn_on')
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ async def test_http_api(hass, test_client):
|
|||||||
assert call.data == {'entity_id': 'light.kitchen'}
|
assert call.data == {'entity_id': 'light.kitchen'}
|
||||||
|
|
||||||
|
|
||||||
async def test_http_api_wrong_data(hass, test_client):
|
async def test_http_api_wrong_data(hass, aiohttp_client):
|
||||||
"""Test the HTTP conversation API."""
|
"""Test the HTTP conversation API."""
|
||||||
result = await component.async_setup(hass, {})
|
result = await component.async_setup(hass, {})
|
||||||
assert result
|
assert result
|
||||||
@ -275,7 +275,7 @@ async def test_http_api_wrong_data(hass, test_client):
|
|||||||
result = await async_setup_component(hass, 'conversation', {})
|
result = await async_setup_component(hass, 'conversation', {})
|
||||||
assert result
|
assert result
|
||||||
|
|
||||||
client = await test_client(hass.http.app)
|
client = await aiohttp_client(hass.http.app)
|
||||||
|
|
||||||
resp = await client.post('/api/conversation/process', json={
|
resp = await client.post('/api/conversation/process', json={
|
||||||
'text': 123
|
'text': 123
|
||||||
|
Loading…
x
Reference in New Issue
Block a user