Skip to content

Commit

Permalink
reinstated mocking unstructured
Browse files Browse the repository at this point in the history
  • Loading branch information
George Burton committed Sep 2, 2024
1 parent 06c874d commit 8025c09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion django_app/tests/management/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8025c09

Please sign in to comment.