Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/document unique name locally #403

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.")
5 changes: 2 additions & 3 deletions django_app/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from botocore.exceptions import ClientError
from django.conf import settings
from django.test import Client
from redbox_app.redbox_core.auth_views import get_or_create_user
from redbox_app.redbox_core.models import (
ChatHistory,
ChatMessage,
Expand All @@ -17,8 +18,6 @@
from requests_mock import Mocker
from yarl import URL

from redbox_app.redbox_core.auth_views import get_or_create_user

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -235,7 +234,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
Loading