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/">'
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)
def test(syncgateway_admin_url): result = AdminClient(syncgateway_admin_url) assert result.url == syncgateway_admin_url assert result._auth is None
def test(syncgateway_admin_url): admin_client = AdminClient(syncgateway_admin_url) result = str(admin_client) assert result == '<AdminClient on "http://localhost:4985/">'
def test_server_down(): bad_client = AdminClient('http://localhost:9999/') with pytest.raises(GatewayDown): bad_client.all_databases()
def test_eq(admin_client, syncgateway_admin_url): other = AdminClient(syncgateway_admin_url) result = admin_client == other assert result is True
def test_neq(admin_client): other = AdminClient('http://example.com/') result = admin_client == other assert result is False
def test_empty_url(): admin_client = AdminClient('') with pytest.raises(ValueError): Database(admin_client, 'test')