async def test_cloud_connect_invalid_auth(mock_client, caplog, cloud_mock_iot): """Test invalid auth detected by server.""" conn = iot.CloudIoT(cloud_mock_iot) mock_client.receive.side_effect = client_exceptions.WSServerHandshakeError( None, None, status=401) await conn.connect() assert "Connection closed: Invalid auth." in caplog.text
def test_cloud_connect_invalid_auth(mock_client, caplog, mock_cloud): """Test invalid auth detected by server.""" conn = iot.CloudIoT(mock_cloud) mock_client.receive.side_effect = \ client_exceptions.WSServerHandshakeError(None, None, code=401) yield from conn.connect() assert 'Connection closed: Invalid auth.' in caplog.text
async def test_cloud_connect_invalid_auth(mock_iot_client, caplog, cloud_mock_iot): """Test invalid auth detected by server.""" conn = MockIoT(cloud_mock_iot) request_info = Mock(real_url="http://example.com") mock_iot_client.receive.side_effect = client_exceptions.WSServerHandshakeError( request_info=request_info, history=None, status=401) await conn.connect() assert "Connection closed: Invalid auth." in caplog.text