From ca558f648507f4cf26a4669abc78e30c9e744c44 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 30 Jan 2017 13:09:36 +0100 Subject: [PATCH] Add unittest for cleanup not validate ssl stuff. (#5643) --- tests/helpers/test_aiohttp_client.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/helpers/test_aiohttp_client.py b/tests/helpers/test_aiohttp_client.py index 4bca671059f..c54770268d0 100644 --- a/tests/helpers/test_aiohttp_client.py +++ b/tests/helpers/test_aiohttp_client.py @@ -100,6 +100,25 @@ class TestHelpersAiohttpClient(unittest.TestCase): assert self.hass.data[client.DATA_CLIENTSESSION].closed assert self.hass.data[client.DATA_CONNECTOR].closed + def test_get_clientsession_cleanup_without_ssl(self): + """Test init clientsession with ssl.""" + run_callback_threadsafe(self.hass.loop, client.async_get_clientsession, + self.hass, False).result() + + assert isinstance( + self.hass.data[client.DATA_CLIENTSESSION_NOTVERIFY], + aiohttp.ClientSession) + assert isinstance( + self.hass.data[client.DATA_CONNECTOR_NOTVERIFY], + aiohttp.TCPConnector) + + run_coroutine_threadsafe( + client.async_cleanup_websession(self.hass), self.hass.loop + ).result() + + assert self.hass.data[client.DATA_CLIENTSESSION_NOTVERIFY].closed + assert self.hass.data[client.DATA_CONNECTOR_NOTVERIFY].closed + @asyncio.coroutine def test_fetching_url(aioclient_mock, hass, test_client):