Skip to content

Commit faf5152

Browse files
committed
improve test
1 parent 6ff9e70 commit faf5152

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backend/app/tests/api/routes/documents/test_route_document_permanent_remove.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from urllib.parse import urlparse
44

55
import pytest
6+
from botocore.exceptions import ClientError
67
from moto import mock_aws
78
from sqlmodel import Session, select
89

@@ -16,7 +17,9 @@
1617
DocumentMaker,
1718
Route,
1819
WebCrawler,
20+
crawler,
1921
)
22+
from app.tests.utils.utils import openai_credentials
2023

2124

2225
@pytest.fixture
@@ -66,6 +69,13 @@ def test_permanently_deletes_document_from_db_and_s3(
6669
assert doc_in_db is not None
6770
assert doc_in_db.deleted_at is not None
6871

72+
with pytest.raises(ClientError) as exc_info:
73+
aws.client.head_object(
74+
Bucket=settings.AWS_S3_BUCKET,
75+
Key=str(s3_key),
76+
)
77+
assert exc_info.value.response["Error"]["Code"] == "404"
78+
6979
@openai_responses.mock()
7080
def test_cannot_delete_nonexistent_document(
7181
self,

0 commit comments

Comments
 (0)