Skip to content

Commit a9ed2a9

Browse files
committed
get ai-written tests passing
1 parent 40cc190 commit a9ed2a9

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

backend/app/tests/api/routes/test_attachments.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime
22
import uuid
33
from typing import Dict
4+
from unittest.mock import patch
45

56
import pytest
67
from fastapi.testclient import TestClient
@@ -114,7 +115,7 @@ def test_list_attachments(
114115

115116

116117
def test_read_attachment_content(
117-
client: TestClient, superuser_token_headers: Dict[str, str], db: Session, mocker
118+
client: TestClient, superuser_token_headers: Dict[str, str], db: Session,
118119
) -> None:
119120
# Create test patient
120121
patient = Patient(
@@ -139,16 +140,12 @@ def test_read_attachment_content(
139140

140141
# Mock the S3 presigned URL generation
141142
mock_url = "https://example.com/presigned-url"
142-
mocker.patch(
143-
"app.api.deps.s3_client.generate_presigned_url",
144-
return_value=mock_url
145-
)
146-
147-
response = client.get(
148-
f"/api/v1/attachments/{attachment.id}/content",
149-
headers=superuser_token_headers,
150-
follow_redirects=False
151-
)
143+
with patch("app.api.deps.s3_client.generate_presigned_url", return_value=mock_url):
144+
response = client.get(
145+
f"/api/v1/attachments/{attachment.id}/content",
146+
headers=superuser_token_headers,
147+
follow_redirects=False
148+
)
152149

153150
assert response.status_code == 302 # Redirect status code
154151
assert response.headers["location"] == mock_url

0 commit comments

Comments
 (0)