feat(portfolios): allow unassigned strategy creation
This commit is contained in:
@@ -507,7 +507,7 @@ def test_delete_already_disabled_is_idempotent() -> None:
|
||||
|
||||
|
||||
# Issue #26: strategy catalog references on portfolio mutations.
|
||||
def test_post_strategy_reference_errors_and_required_contract() -> None:
|
||||
def test_post_strategy_reference_errors_and_optional_contract() -> None:
|
||||
repo = _FakeRepo(asset=_make_asset(_ASSET_UUID, "active"))
|
||||
client = _make_client()
|
||||
with _with_repo(repo):
|
||||
@@ -516,7 +516,7 @@ def test_post_strategy_reference_errors_and_required_contract() -> None:
|
||||
json={"asset_id": _ASSET_UUID, "broker": "kiwoom", "strategy_id": "missing"},
|
||||
headers=_auth("admin-tok"),
|
||||
)
|
||||
invalid = client.post(
|
||||
without_strategy = client.post(
|
||||
"/v1/portfolios",
|
||||
json={"asset_id": _ASSET_UUID, "broker": "kiwoom"},
|
||||
headers=_auth("admin-tok"),
|
||||
@@ -528,7 +528,8 @@ def test_post_strategy_reference_errors_and_required_contract() -> None:
|
||||
headers=_auth("admin-tok"),
|
||||
)
|
||||
assert missing.status_code == 404
|
||||
assert invalid.status_code == 422
|
||||
assert without_strategy.status_code == 201
|
||||
assert without_strategy.json()["active_strategy_id"] is None
|
||||
assert inactive.status_code == 409
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user