def test_auth_is_set_correctly(): connection = AIOHttpConnection(http_auth=('user', 'secret')) assert connection.session._default_auth == aiohttp.BasicAuth( 'user', 'secret') connection = AIOHttpConnection(http_auth='user:secret') assert connection.session._default_auth == aiohttp.BasicAuth( 'user', 'secret')
def test_ssl_context_is_correctly(event_loop): context = create_ssl_context(cafile="test_elasticsearch_async/ca.crt") connection = AIOHttpConnection(ssl_context=context, http_auth=('user', 'secret'), loop=event_loop) assert connection.session.connector._ssl.get_ca_certs() == [{ 'subject': ((('commonName', 'Elastic Certificate Tool Autogenerated CA'),),), 'issuer': ((('commonName', 'Elastic Certificate Tool Autogenerated CA'),),), 'version': 3, 'serialNumber': 'C732AB792FAC34EB252EE2F03A316CD8CFE203B3', 'notBefore': 'Aug 26 18:27:28 2017 GMT', 'notAfter': 'Aug 25 18:27:28 2020 GMT' }]
def test_dns_cache_can_be_disabled(event_loop): connection = AIOHttpConnection(loop=event_loop, use_dns_cache=False) assert connection.session.connector.use_dns_cache is False
def test_dns_cache_is_enabled_by_default(event_loop): connection = AIOHttpConnection(loop=event_loop) assert connection.session.connector.use_dns_cache is True