test: tighten regression guard and hoist httpx import
Per review: - Hoist `import httpx` out of the two test function bodies and into the module imports at the top of test_astrolabe_chunk_context.py. - Simplify the regression guard in test_management_chunk_context_endpoint.py to use `mock.assert_awaited_once_with(...)` instead of manually unpacking call_args. This is stricter — it fails loudly on signature change — and matches the canonical pattern for asserting mock calls. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
06d871ce22
commit
b3bd14f183
@@ -25,6 +25,7 @@ import logging
|
||||
import re
|
||||
import uuid
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from tests.conftest import create_mcp_client_session
|
||||
@@ -208,8 +209,6 @@ async def test_chunk_context_endpoint_uses_app_password(
|
||||
@pytest.mark.timeout(60)
|
||||
async def test_chunk_context_endpoint_requires_authentication():
|
||||
"""Direct HTTP hit at /api/v1/chunk-context without a bearer must 401."""
|
||||
import httpx
|
||||
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(
|
||||
"http://localhost:8003/api/v1/chunk-context",
|
||||
@@ -235,8 +234,6 @@ async def test_chunk_context_endpoint_rejects_invalid_bearer():
|
||||
`validate_token_and_get_user`, which must turn into a clean 401/404 from
|
||||
the HTTP layer, not an opaque 500.
|
||||
"""
|
||||
import httpx
|
||||
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(
|
||||
"http://localhost:8003/api/v1/chunk-context",
|
||||
|
||||
Reference in New Issue
Block a user