From d072ca60bb002b2f6bf4b6eaedbf05e701bc2c61 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 8 Apr 2026 05:13:17 +0530 Subject: [PATCH] test: enhance file classification tests for Azure DI configuration --- .../etl_pipeline/test_etl_pipeline_service.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/surfsense_backend/tests/unit/etl_pipeline/test_etl_pipeline_service.py b/surfsense_backend/tests/unit/etl_pipeline/test_etl_pipeline_service.py index 2ca0cb1a3..9add87879 100644 --- a/surfsense_backend/tests/unit/etl_pipeline/test_etl_pipeline_service.py +++ b/surfsense_backend/tests/unit/etl_pipeline/test_etl_pipeline_service.py @@ -609,7 +609,9 @@ async def test_extract_zip_raises_unsupported_error(tmp_path): ("file.heif", "UNSTRUCTURED", True), ], ) -def test_should_skip_for_service(filename, etl_service, expected_skip): +def test_should_skip_for_service(filename, etl_service, expected_skip, monkeypatch): + monkeypatch.setattr("app.config.config.AZURE_DI_ENDPOINT", None, raising=False) + monkeypatch.setattr("app.config.config.AZURE_DI_KEY", None, raising=False) from app.etl_pipeline.file_classifier import should_skip_for_service assert should_skip_for_service(filename, etl_service) is expected_skip, ( @@ -617,6 +619,19 @@ def test_should_skip_for_service(filename, etl_service, expected_skip): ) +def test_heif_not_skipped_for_llamacloud_when_azure_di_configured(monkeypatch): + """With Azure DI credentials, .heif is accepted by LLAMACLOUD.""" + monkeypatch.setattr( + "app.config.config.AZURE_DI_ENDPOINT", + "https://fake.cognitiveservices.azure.com/", + raising=False, + ) + monkeypatch.setattr("app.config.config.AZURE_DI_KEY", "fake-key", raising=False) + from app.etl_pipeline.file_classifier import should_skip_for_service + + assert should_skip_for_service("file.heif", "LLAMACLOUD") is False + + # --------------------------------------------------------------------------- # Slice 14b - ETL pipeline rejects per-parser incompatible documents # ---------------------------------------------------------------------------