示例#1
0
def es_connection(es):
    """ """
    host, port = es
    conn_str = "es://@{0}:{1}/".format(host, port)
    conn = create_connection(conn_str, "elasticsearch.Elasticsearch")
    assert conn.raw_connection.ping()
    yield conn
示例#2
0
def init_fhirbase_pg(fhirbase_pg):
    """ """
    host, port = fhirbase_pg
    conn_str = "pg://postgres:@{0}:{1}/fhir_db".format(host, port)
    connection = create_connection(conn_str)
    _init_fhirbase_structure(connection)
    yield connection
示例#3
0
def test_pg_connection_creation(fhirbase_pg):
    """ """
    host, port = fhirbase_pg
    conn_str = "pg://postgres:@{0}:{1}/fhir_db".format(host, port)
    connection = create_connection(conn_str)
    info = connection.server_info()
    assert info is not None
示例#4
0
async def async_es_connection(es):
    """ """
    host, port = es
    conn_str = "es://@{0}:{1}/".format(host, port)
    conn = create_connection(conn_str, "elasticsearch.AsyncElasticsearch")
    assert await conn.raw_connection.ping()
    yield conn
    await conn.raw_connection.close()
示例#5
0
def test_es_connection_creation(es):
    """ """
    host, port = es
    conn_str = "es://@{0}:{1}/".format(host, port)
    conn = create_connection(conn_str, Elasticsearch)
    assert conn.raw_connection.ping() is True

    conn = ES.ElasticsearchConnection.from_url(conn_str)
    assert conn.raw_connection.ping() is True
示例#6
0
async def test_async_es_connection_creation(es):
    """ """
    host, port = es
    conn_str = "es://@{0}:{1}/".format(host, port)
    conn = create_connection(conn_str, "elasticsearch.AsyncElasticsearch")
    assert isinstance(conn.raw_connection, AsyncElasticsearch)
    assert await conn.raw_connection.ping() is True

    conn = ES.AsyncElasticsearchConnection.from_url(conn_str)
    assert isinstance(conn.raw_connection, AsyncElasticsearch)
    assert await conn.raw_connection.ping() is True