Skip to content

Commit

Permalink
Test fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunns authored and 252afh committed May 17, 2024
1 parent b37f2e1 commit 04f7bd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions django_app/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest
import pytz
from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile
from django.core.management import call_command
from redbox_app.redbox_core import client
from redbox_app.redbox_core.models import ChatHistory, ChatMessage, ChatRoleEnum, File, User
Expand Down Expand Up @@ -105,6 +106,13 @@ def chat_message(chat_history: ChatHistory, uploaded_file: File) -> ChatMessage:


@pytest.fixture
def uploaded_file(alice: User) -> File:
file = File.objects.create(user=alice, original_file_name="uploaded_file.pdf", core_file_uuid=uuid.uuid4())
def uploaded_file(alice: User, original_file: UploadedFile) -> File:
file = File.objects.create(
user=alice, original_file=original_file, original_file_name=original_file.name, core_file_uuid=uuid.uuid4()
)
return file


@pytest.fixture
def original_file() -> UploadedFile:
return SimpleUploadedFile("original_file.txt", b"Lorem Ipsum.")
2 changes: 1 addition & 1 deletion django_app/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_view_session_with_documents(chat_message: ChatMessage, client: Client):

# Then
assert response.status_code == HTTPStatus.OK
assert b"uploaded_file.pdf" in response.content
assert b"original_file.txt" in response.content


@pytest.mark.django_db
Expand Down

0 comments on commit 04f7bd6

Please sign in to comment.