def test_uses_es6_when_specified(self): client = Client(host="http://localhost:9200", index="hypothesis", elasticsearch=elasticsearch) assert client.version == (6, 2, 0) assert isinstance(client.conn, elasticsearch.Elasticsearch)
def test_it_sets_the_index_property(self): client = Client(host="http://localhost:9200", index="hypothesis") assert client.index == "hypothesis"
def test_conn_is_read_only(self): client = Client(host="http://localhost:9200", index="hypothesis") with pytest.raises(AttributeError, match="can't set attribute"): client.conn = "changed"
def test_it_sets_the_conn_property(self): client = Client(host="http://localhost:9200", index="hypothesis") assert isinstance(client.conn, elasticsearch.Elasticsearch)
def test_it_sets_the_version_property(self): client = Client(host="http://localhost:9200", index="hypothesis") assert client.version >= (6, 4, 0) and client.version < (7, 0, 0)
def test_defaults_to_es1(self): client = Client(host="http://localhost:9200", index="hypothesis") assert isinstance(client.conn, elasticsearch1.Elasticsearch)
def client(self, conn): return Client(index=sentinel.index, conn=conn)