resolve payer: read the response's JSON (the stub hid this)
ci/woodpecker/push/woodpecker Pipeline was canceled

_oc_graphql_post returns the RESPONSE — it is a retrying wrapper around
client.post — so fetch_account_by_slug has to call .json() on it. My unit test
stubbed it as a dict, so the test passed and the first live call in the container
died with "Response object has no attribute get".

The test now stubs the real shape (a response wrapper with .json()). Folding it
in here rather than hiding it: a stub that does not match the real return shape
certifies nothing.
This commit is contained in:
inference-admin committed 2026-11-13 22:13:22 +00:00
1 parent cbf5a6870b
commit 9c10e627fc
2 files changed
+19 -3

No files matched your search

+6 -1
View File
@@ -7414,7 +7414,12 @@ async def fetch_account_by_slug(slug: str) -> dict | None:
"... on Individual { email isIncognito } } }")
try:
async with httpx.AsyncClient(timeout=30.0) as client:
data = await _oc_graphql_post(client, {"query": query, "variables": {"slug": slug}})
# _oc_graphql_post returns the RESPONSE (it is a retrying wrapper
# around client.post), so the JSON is read here. Getting this wrong
# is invisible to a stubbed test and fatal in the container: the
# first live run raised 'Response object has no attribute get'.
resp = await _oc_graphql_post(client, {"query": query, "variables": {"slug": slug}})
data = resp.json()
except Exception as e: # read failure: report, never raise
logger.warning("OC account lookup failed for slug %s: %s", slug, e)
return None