Skip to content

Commit 15a49f3

Browse files
committed
TEST cover deprecated HTTP upload fallback
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5e26abb-1f6f-4138-8a23-4cfb10e1625f
1 parent 6d5b68a commit 15a49f3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/unit/prompt_target/target/test_http_api_target.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ async def test_send_prompt_async_file_upload_preserves_query_params(mock_request
7272
params={"alpha": "1"},
7373
timeout=180,
7474
)
75-
await target.send_prompt_async(message=message)
75+
with pytest.warns(DeprecationWarning, match="implicit text-path uploads"):
76+
await target.send_prompt_async(message=message)
7677

7778
assert mock_request.call_args.kwargs["params"] == {"alpha": "1"}
7879

@@ -151,14 +152,16 @@ async def test_send_prompt_async_follows_redirects_when_enabled(mock_request, pa
151152

152153

153154
@patch("httpx.AsyncClient.request")
154-
async def test_send_prompt_async_missing_explicit_file_path_raises(mock_request, patch_central_database):
155+
async def test_send_prompt_async_missing_explicit_file_path_raises(mock_request, patch_central_database, tmp_path):
155156
message_piece = MessagePiece(role="user", original_value="mock", converted_value="trigger")
156157
message = Message(message_pieces=[message_piece])
158+
missing_file = tmp_path / "missing.pdf"
157159

158160
target = HTTPXAPITarget(
159161
http_url="http://example.com/upload/",
160162
method="POST",
161-
file_path="/definitely/missing/file.pdf",
163+
file_path=str(missing_file),
164+
allowed_upload_directory=tmp_path,
162165
timeout=180,
163166
)
164167

0 commit comments

Comments
 (0)