OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
test: cover idempotent delete for missing documents in SDK integrations
Olfa Maslahb05341da2fb5
diff --git a/sdks/python/tests/test_integration.py b/sdks/python/tests/test_integration.pyindex c05c251b7..c1a202ba5 100644--- a/sdks/python/tests/test_integration.py+++ b/sdks/python/tests/test_integration.py@@ -291,6 +291,19 @@ class TestDocuments:assert result.success is Falseassert result.deleted_chunks == 0+ @pytest.mark.asyncio+ async def test_delete_missing_document_is_idempotent(self, client):+ """Deleting a never-ingested filename should not raise."""+ import uuid++ missing_filename = f"never_ingested_{uuid.uuid4().hex}.pdf"+ result = await client.documents.delete(missing_filename)++ assert result.success is False+ assert result.deleted_chunks == 0+ assert result.filename == missing_filename+ assert result.error is not None+class TestSearch:"""Test search operations."""diff --git a/sdks/typescript/tests/integration.test.ts b/sdks/typescript/tests/integration.test.tsindex 01977759f..6e1dd6ffe 100644--- a/sdks/typescript/tests/integration.test.ts+++ b/sdks/typescript/tests/integration.test.ts@@ -287,6 +287,19 @@ describe.skipIf(SKIP_TESTS)("OpenRAG TypeScript SDK Integration", () => {expect(result.deleted_chunks).toBe(0);}});++ it("should treat delete of missing document as idempotent", async () => {+ const missingFilename = `never_ingested_${Date.now()}_${Math.random()+ .toString(16)+ .slice(2)}.pdf`;++ const result = await client.documents.delete(missingFilename);++ expect(result.success).toBe(false);+ expect(result.deleted_chunks).toBe(0);+ expect(result.filename).toBe(missingFilename);+ expect(result.error).toBeDefined();+ });});describe("Search", () => {