fix: agreement cancellation FIFO semantics, modal rendering, and list status badges
This commit is contained in:
@@ -254,8 +254,9 @@ def test_cancel_rejected_when_work_item_closed_in_ks2(db_session, project_id):
|
||||
db_session.commit()
|
||||
approve_agreement(db_session, a.id)
|
||||
|
||||
_add_dr(db_session, project_id, wi.id, Decimal("50"))
|
||||
_ks2_close(db_session, project_id, wi.id, Decimal("10"))
|
||||
# base=100, DS=+10. Close 105 → 5 of DS volume used → block
|
||||
_add_dr(db_session, project_id, wi.id, Decimal("105"))
|
||||
_ks2_close(db_session, project_id, wi.id, Decimal("105"))
|
||||
|
||||
reason = agreement_cancel_block_reason(db_session, a)
|
||||
assert reason is not None
|
||||
@@ -334,8 +335,9 @@ def test_rollback_preserves_approved_status(db_session, project_id):
|
||||
db_session.commit()
|
||||
approve_agreement(db_session, a.id)
|
||||
|
||||
_add_dr(db_session, project_id, wi.id, Decimal("50"))
|
||||
_ks2_close(db_session, project_id, wi.id, Decimal("10"))
|
||||
# base=100, DS=+10. Close 105 → DS volume used → cancel must fail
|
||||
_add_dr(db_session, project_id, wi.id, Decimal("105"))
|
||||
_ks2_close(db_session, project_id, wi.id, Decimal("105"))
|
||||
|
||||
# cancel fails → rollback → still approved
|
||||
with pytest.raises(ValueError):
|
||||
@@ -397,8 +399,8 @@ def test_ui_cancelled_shows_otpmeneno(db_session, project_id):
|
||||
page = client.get(f"/projects/{project_id}/agreements/{a.id}")
|
||||
assert page.status_code == 200
|
||||
assert "ОТМЕНЕНО" in page.text
|
||||
assert "Отменить ДС" not in page.text
|
||||
assert "Удалить ДС" not in page.text
|
||||
assert 'data-bs-target="#cancelAgreementModal"' not in page.text
|
||||
assert 'data-bs-target="#deleteAgreementModal"' not in page.text
|
||||
finally:
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user