コード例 #1
0
def test():
    admin_client = AdminClient('http://example.com:4985/')
    database = Database(admin_client, 'test')

    result = str(database)

    assert result == '<Database "http://example.com:4985/test/">'
コード例 #2
0
def admin_client(syncgateway_admin_url, cleanup_databases):
    """
    Returns:
        AdminClient: Pointed at default admin API URL. Asserts that there are
        no databases at the start of test. Deletes all databases at end of
        test.
    """
    admin_client = AdminClient(syncgateway_admin_url)

    if cleanup_databases:
        purge_databases(admin_client)

    all_databases = admin_client.all_databases()
    assert len(all_databases) == 0, (
        "Test initialised with {} unexpected Databases {}. "
        "Try setting `cleanup_databases` fixture to `True`?".format(
            len(all_databases), all_databases))

    yield admin_client

    purge_databases(admin_client)
コード例 #3
0
def test(syncgateway_admin_url):
    result = AdminClient(syncgateway_admin_url)

    assert result.url == syncgateway_admin_url
    assert result._auth is None
コード例 #4
0
def test(syncgateway_admin_url):
    admin_client = AdminClient(syncgateway_admin_url)

    result = str(admin_client)

    assert result == '<AdminClient on "http://localhost:4985/">'
コード例 #5
0
def test_server_down():
    bad_client = AdminClient('http://localhost:9999/')

    with pytest.raises(GatewayDown):
        bad_client.all_databases()
コード例 #6
0
def test_eq(admin_client, syncgateway_admin_url):
    other = AdminClient(syncgateway_admin_url)

    result = admin_client == other

    assert result is True
コード例 #7
0
def test_neq(admin_client):
    other = AdminClient('http://example.com/')

    result = admin_client == other

    assert result is False
コード例 #8
0
def test_empty_url():
    admin_client = AdminClient('')

    with pytest.raises(ValueError):
        Database(admin_client, 'test')