fairagro-middleware-api-client 9.1.1.dev19__tar.gz → 9.1.1.dev22__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/PKG-INFO +1 -1
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/src/middleware/api_client/api_client.py +2 -2
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/unit/test_client.py +34 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/.gitignore +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/README.md +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/example_client_config.yaml +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/pyproject.toml +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/spec/harvest-client/design.md +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/spec/harvest-client/spec.md +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/src/middleware/api_client/__init__.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/src/middleware/api_client/config.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/src/middleware/api_client/models.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/src/middleware/api_client/py.typed +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/conftest.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/integration/conftest.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/integration/test_create_arcs.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/unit/test_api_client_config.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/unit/test_client_config.py +0 -0
- {fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/tests/unit/test_retry_logic.py +0 -0
|
@@ -471,7 +471,7 @@ class ApiClient:
|
|
|
471
471
|
return await self._request_with_retries(
|
|
472
472
|
"POST",
|
|
473
473
|
path,
|
|
474
|
-
content=body.model_dump_json(),
|
|
474
|
+
content=body.model_dump_json(by_alias=True),
|
|
475
475
|
headers={"content-type": "application/json"},
|
|
476
476
|
)
|
|
477
477
|
|
|
@@ -496,7 +496,7 @@ class ApiClient:
|
|
|
496
496
|
return await self._request_with_retries(
|
|
497
497
|
"PATCH",
|
|
498
498
|
path,
|
|
499
|
-
content=body.model_dump_json(),
|
|
499
|
+
content=body.model_dump_json(by_alias=True),
|
|
500
500
|
headers={"content-type": "application/json"},
|
|
501
501
|
)
|
|
502
502
|
|
|
@@ -327,6 +327,40 @@ async def test_create_or_update_arc_sends_correct_headers(client_config: Config)
|
|
|
327
327
|
assert req.headers["content-type"] == "application/json"
|
|
328
328
|
|
|
329
329
|
|
|
330
|
+
@pytest.mark.asyncio
|
|
331
|
+
@respx.mock
|
|
332
|
+
async def test_create_or_update_arc_serializes_rocrate_wire_aliases(client_config: Config) -> None:
|
|
333
|
+
"""ARC upload JSON must use @context and @graph, not Python field names."""
|
|
334
|
+
route = respx.post(f"{client_config.api_url}v3/arcs").mock(
|
|
335
|
+
return_value=httpx.Response(http.HTTPStatus.OK, json=_ARC_RESPONSE)
|
|
336
|
+
)
|
|
337
|
+
async with ApiClient(client_config) as client:
|
|
338
|
+
await client.create_or_update_arc(rdi="test-rdi", arc=_rocrate_dict())
|
|
339
|
+
|
|
340
|
+
body = json.loads(route.calls.last.request.content.decode())
|
|
341
|
+
assert "@context" in body["arc"]
|
|
342
|
+
assert "@graph" in body["arc"]
|
|
343
|
+
assert "context" not in body["arc"]
|
|
344
|
+
assert "graph" not in body["arc"]
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
@pytest.mark.asyncio
|
|
348
|
+
@respx.mock
|
|
349
|
+
async def test_submit_arc_in_harvest_serializes_rocrate_wire_aliases(client_config: Config) -> None:
|
|
350
|
+
"""Harvest ARC upload JSON must use @context and @graph wire aliases."""
|
|
351
|
+
route = respx.post(f"{client_config.api_url}v3/harvests/harvest-456/arcs").mock(
|
|
352
|
+
return_value=httpx.Response(http.HTTPStatus.OK, json=_ARC_RESPONSE)
|
|
353
|
+
)
|
|
354
|
+
async with ApiClient(client_config) as client:
|
|
355
|
+
await client.submit_arc_in_harvest("harvest-456", arc=_rocrate_dict())
|
|
356
|
+
|
|
357
|
+
body = json.loads(route.calls.last.request.content.decode())
|
|
358
|
+
assert "@context" in body["arc"]
|
|
359
|
+
assert "@graph" in body["arc"]
|
|
360
|
+
assert "context" not in body["arc"]
|
|
361
|
+
assert "graph" not in body["arc"]
|
|
362
|
+
|
|
363
|
+
|
|
330
364
|
# ---------------------------------------------------------------------------
|
|
331
365
|
# Generic _get / error paths
|
|
332
366
|
# ---------------------------------------------------------------------------
|
{fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/.gitignore
RENAMED
|
File without changes
|
{fairagro_middleware_api_client-9.1.1.dev19 → fairagro_middleware_api_client-9.1.1.dev22}/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|