(respx_mock: MockRouter)
| 439 | @pytest.mark.respx() |
| 440 | @pytest.mark.asyncio() |
| 441 | async def test_api_key_request_async(respx_mock: MockRouter) -> None: |
| 442 | respx_mock.post(re.compile(r"https://aws-external-anthropic\.us-east-1\.api\.aws/.*")).mock( |
| 443 | return_value=httpx2.Response(200, json={"foo": "bar"}) |
| 444 | ) |
| 445 | |
| 446 | client = AsyncAnthropicAWS(api_key="test-key", aws_region="us-east-1", workspace_id="ws-123") |
| 447 | await client.messages.create( |
| 448 | max_tokens=1024, |
| 449 | messages=[{"role": "user", "content": "Hello"}], |
| 450 | model="claude-sonnet-4-20250514", |
| 451 | ) |
| 452 | |
| 453 | calls = cast("list[MockRequestCall]", respx_mock.calls) |
| 454 | assert len(calls) == 1 |
| 455 | assert str(calls[0].request.url) == "https://aws-external-anthropic.us-east-1.api.aws/v1/messages" |
| 456 | assert calls[0].request.headers["Authorization"] == "Bearer test-key" |
| 457 | assert "X-Api-Key" not in calls[0].request.headers |
| 458 | |
| 459 | |
| 460 | @pytest.mark.filterwarnings("ignore::DeprecationWarning") |
nothing calls this directly
no test coverage detected