From 8025c0954d13386114bbb20960ebf8b498f0e196 Mon Sep 17 00:00:00 2001 From: George Burton Date: Mon, 2 Sep 2024 07:28:42 +0100 Subject: [PATCH] reinstated mocking unstructured --- django_app/tests/management/test_commands.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/django_app/tests/management/test_commands.py b/django_app/tests/management/test_commands.py index 1d78b5b12..c3e170448 100644 --- a/django_app/tests/management/test_commands.py +++ b/django_app/tests/management/test_commands.py @@ -240,10 +240,15 @@ def test_delete_expired_chats(chat: Chat, msg_1_date: datetime, msg_2_date: date @pytest.mark.django_db(transaction=True) -def test_reingest_files(uploaded_file: File, mocker): +def test_reingest_files(uploaded_file: File, requests_mock: Mocker, mocker): # Given assert uploaded_file.status == StatusEnum.processing + requests_mock.post( + f"http://{settings.UNSTRUCTURED_HOST}:8000/general/v0/general", + json=[{"text": "hello", "metadata": {"filename": "my-file.txt"}}], + ) + # When with mocker.patch("redbox.chains.ingest.VectorStore.add_documents", return_value=[]): call_command("reingest_files", sync=True)