Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit b5f230e

Browse files
author
Phil Varner
committed
add method POST to create-order link
1 parent 96bcc8f commit b5f230e

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## unreleased
9+
10+
### Fixed
11+
12+
- Add parameter method as "POST" to create-order link
13+
814
## [v0.6.0] - 2025-02-11
915

1016
### Added

tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,14 @@ def _assert_link(
143143
rel: str,
144144
path: str,
145145
media_type: str = "application/json",
146+
method: str | None = None,
146147
):
147148
link = find_link(body["links"], rel)
148149
assert link, f"{req} Link[rel={rel}] should exist"
149150
assert link["type"] == media_type
150151
assert link["href"] == url_for(path)
152+
if method:
153+
assert link["method"] == method
151154

152155
return _assert_link
153156

tests/test_opportunity.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ def test_search_opportunities_response(
2727
except Exception as _:
2828
pytest.fail("response is not an opportunity collection")
2929

30-
assert_link(f"POST {url}", body, "create-order", f"/products/{product_id}/orders")
30+
assert_link(
31+
f"POST {url}",
32+
body,
33+
"create-order",
34+
f"/products/{product_id}/orders",
35+
method="POST",
36+
)
3137

3238

3339
@pytest.mark.parametrize("limit", [0, 1, 2, 4])

tests/test_opportunity_async.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def test_async_opportunity_search_to_completion(
205205
rel="create-order",
206206
href=url_for(f"/products/{product_id}/orders"),
207207
body=search_record.opportunity_request.model_dump(),
208+
method="POST",
208209
)
209210
)
210211
collection.links.append(

tests/test_product.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def test_product_response_self_link(
3838
url, body, "order-parameters", f"/products/{product_id}/order-parameters"
3939
)
4040
assert_link(url, body, "opportunities", f"/products/{product_id}/opportunities")
41-
assert_link(url, body, "create-order", f"/products/{product_id}/orders")
41+
assert_link(
42+
url, body, "create-order", f"/products/{product_id}/orders", method="POST"
43+
)
4244

4345

4446
@pytest.mark.parametrize("product_id", ["test-spotlight"])
@@ -100,6 +102,7 @@ def test_get_products_pagination(
100102
"href": f"http://stapiserver/products/{product_id}/orders",
101103
"rel": "create-order",
102104
"type": "application/json",
105+
"method": "POST",
103106
},
104107
{
105108
"href": f"http://stapiserver/products/{product_id}/opportunities",

0 commit comments

Comments
 (0)