|
12 | 12 | Message, |
13 | 13 | ) |
14 | 14 | from backend.schemas.user import User |
15 | | -from backend.services.file import MAX_FILE_SIZE, MAX_TOTAL_FILE_SIZE, get_file_service |
| 15 | +from backend.services.file import get_file_service |
16 | 16 | from backend.tests.unit.factories import get_factory |
17 | 17 |
|
18 | 18 |
|
@@ -594,73 +594,6 @@ def test_batch_upload_file_existing_conversation( |
594 | 594 | assert len(files_stored) == len(file_paths) |
595 | 595 |
|
596 | 596 |
|
597 | | -def test_batch_upload_total_files_exceeds_limit( |
598 | | - session_client: TestClient, session: Session, user, mock_compass_settings |
599 | | -) -> None: |
600 | | - _ = get_factory("Conversation", session).create(user_id=user.id) |
601 | | - file_paths = { |
602 | | - "Mariana_Trench.pdf": "src/backend/tests/unit/test_data/Mariana_Trench.pdf", |
603 | | - "Cardistry.pdf": "src/backend/tests/unit/test_data/Cardistry.pdf", |
604 | | - "Tapas.pdf": "src/backend/tests/unit/test_data/Tapas.pdf", |
605 | | - "Mount_Everest.pdf": "src/backend/tests/unit/test_data/Mount_Everest.pdf", |
606 | | - } |
607 | | - files = [ |
608 | | - ("files", (file_name, open(file_path, "rb"))) |
609 | | - for file_name, file_path in file_paths.items() |
610 | | - ] |
611 | | - |
612 | | - conversation = get_factory("Conversation", session).create(user_id=user.id) |
613 | | - file = get_factory("File", session).create( |
614 | | - file_name="test_file.txt", |
615 | | - user_id=conversation.user_id, |
616 | | - file_size=1000000000, |
617 | | - ) |
618 | | - _ = get_factory("ConversationFileAssociation", session).create( |
619 | | - conversation_id=conversation.id, user_id=user.id, file_id=file.id |
620 | | - ) |
621 | | - |
622 | | - response = session_client.post( |
623 | | - "/v1/conversations/batch_upload_file", |
624 | | - files=files, |
625 | | - headers={"User-Id": conversation.user_id}, |
626 | | - ) |
627 | | - |
628 | | - assert response.status_code == 400 |
629 | | - assert response.json() == { |
630 | | - "detail": f"Total file size exceeds the maximum allowed size of {MAX_TOTAL_FILE_SIZE} bytes." |
631 | | - } |
632 | | - |
633 | | - |
634 | | -def test_batch_upload_single_file_exceeds_limit( |
635 | | - session_client: TestClient, session: Session, user, mock_compass_settings |
636 | | -) -> None: |
637 | | - _ = get_factory("Conversation", session).create(user_id=user.id) |
638 | | - file_paths = { |
639 | | - "Mariana_Trench.pdf": "src/backend/tests/unit/test_data/Mariana_Trench.pdf", |
640 | | - "Cardistry.pdf": "src/backend/tests/unit/test_data/Cardistry.pdf", |
641 | | - "26mb.pdf": "src/backend/tests/unit/test_data/26mb.pdf", |
642 | | - "Tapas.pdf": "src/backend/tests/unit/test_data/Tapas.pdf", |
643 | | - "Mount_Everest.pdf": "src/backend/tests/unit/test_data/Mount_Everest.pdf", |
644 | | - } |
645 | | - files = [ |
646 | | - ("files", (file_name, open(file_path, "rb"))) |
647 | | - for file_name, file_path in file_paths.items() |
648 | | - ] |
649 | | - |
650 | | - conversation = get_factory("Conversation", session).create(user_id=user.id) |
651 | | - |
652 | | - response = session_client.post( |
653 | | - "/v1/conversations/batch_upload_file", |
654 | | - files=files, |
655 | | - headers={"User-Id": conversation.user_id}, |
656 | | - ) |
657 | | - |
658 | | - assert response.status_code == 400 |
659 | | - assert response.json() == { |
660 | | - "detail": f"26mb.pdf exceeds the maximum allowed size of {MAX_FILE_SIZE} bytes." |
661 | | - } |
662 | | - |
663 | | - |
664 | 597 | def test_batch_upload_file_nonexistent_conversation_creates_new_conversation( |
665 | 598 | session_client: TestClient, session: Session, user, mock_compass_settings |
666 | 599 | ) -> None: |
|
0 commit comments