async def test_view(hass): """Test view.""" hass.config_entries.flow.async_init = AsyncMock() request = aiohttp.MockRequest(b"", query_string="code=test_code") request.app = {"hass": hass} view = config_flow.AmbiclimateAuthCallbackView() assert await view.get(request) == "OK!" request = aiohttp.MockRequest(b"", query_string="") request.app = {"hass": hass} view = config_flow.AmbiclimateAuthCallbackView() assert await view.get(request) == "No code"
async def test_view(hass): """Test view.""" hass.config_entries.flow.async_init = Mock() request = aiohttp.MockRequest(b'', query_string='code=test_code') request.app = {'hass': hass} view = config_flow.AmbiclimateAuthCallbackView() assert await view.get(request) == 'OK!' request = aiohttp.MockRequest(b'', query_string='') request.app = {'hass': hass} view = config_flow.AmbiclimateAuthCallbackView() assert await view.get(request) == 'No code'