Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_should_create_fake_elasticsearch_instance(self):
self.assertIsInstance(self.es, FakeElasticsearch)
def test_should_create_fake_elasticsearch_instance(self):
self.assertIsInstance(self.es, FakeElasticsearch)
def _get_elasticmock(hosts=None, *args, **kwargs):
host = _normalize_hosts(hosts)[0]
elastic_key = '{0}:{1}'.format(
host.get('host', 'localhost'), host.get('port', 9200)
)
if elastic_key in ELASTIC_INSTANCES:
connection = ELASTIC_INSTANCES.get(elastic_key)
else:
connection = FakeElasticsearch()
ELASTIC_INSTANCES[elastic_key] = connection
return connection