fix(daemons): block owner transfer while assigned
This commit is contained in:
@@ -402,6 +402,20 @@ def test_patch_foreign_daemon_returns_404() -> None:
|
||||
assert resp.status_code == 404
|
||||
|
||||
|
||||
def test_patch_missing_daemon_returns_404_without_changing_portfolio() -> None:
|
||||
repo = _repo_with_portfolio_and_daemons(owner=_USER_ID)
|
||||
client = _make_client()
|
||||
|
||||
with _with_repo(repo):
|
||||
resp = client.patch(
|
||||
f"/v1/portfolios/{_PORTFOLIO_UUID}",
|
||||
json={"managed_by_daemon_id": "ffffffff-ffff-ffff-ffff-ffffffffffff"},
|
||||
headers=_auth("admin-tok"),
|
||||
)
|
||||
assert resp.status_code == 404
|
||||
assert repo.get(_PORTFOLIO_UUID).managed_by_daemon_id is None
|
||||
|
||||
|
||||
def test_patch_inactive_daemon_returns_409() -> None:
|
||||
repo = _repo_with_portfolio_and_daemons(owner=_USER_ID, is_active=False)
|
||||
client = _make_client()
|
||||
@@ -412,4 +426,4 @@ def test_patch_inactive_daemon_returns_409() -> None:
|
||||
json={"managed_by_daemon_id": _DAEMON_UUID},
|
||||
headers=_auth("admin-tok"),
|
||||
)
|
||||
assert resp.status_code == 409
|
||||
assert resp.status_code == 409
|
||||
|
||||
Reference in New Issue
Block a user