예제 #1
0
파일: client_test.py 프로젝트: yumatch/h
    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)
예제 #2
0
    def test_it_sets_the_index_property(self):
        client = Client(host="http://localhost:9200", index="hypothesis")

        assert client.index == "hypothesis"
예제 #3
0
    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"
예제 #4
0
    def test_it_sets_the_conn_property(self):
        client = Client(host="http://localhost:9200", index="hypothesis")

        assert isinstance(client.conn, elasticsearch.Elasticsearch)
예제 #5
0
    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)
예제 #6
0
    def test_defaults_to_es1(self):
        client = Client(host="http://localhost:9200", index="hypothesis")

        assert isinstance(client.conn, elasticsearch1.Elasticsearch)
예제 #7
0
 def client(self, conn):
     return Client(index=sentinel.index, conn=conn)