dev #11

Merged
k1nq merged 76 commits from dev into master 2025-11-30 04:48:35 +00:00
1 changed files with 51 additions and 0 deletions
Showing only changes of commit 1c206323a2 - Show all commits

View File

@ -163,6 +163,57 @@ async def test_stage_rollback_allowed_for_admin(session: AsyncSession) -> None:
assert updated.stage == DealStage.PROPOSAL
@pytest.mark.asyncio
async def test_stage_rollback_allowed_for_owner(session: AsyncSession) -> None:
context, contact, repo = await _persist_base(session, role=OrganizationRole.OWNER)
service = DealService(repository=repo)
deal = await service.create_deal(
DealCreate(
organization_id=context.organization_id,
contact_id=contact.id,
owner_id=context.user_id,
title="Owner Rollback",
amount=Decimal("2500"),
),
context=context,
)
deal.stage = DealStage.CLOSED
updated = await service.update_deal(
deal,
DealUpdateData(stage=DealStage.NEGOTIATION),
context=context,
)
assert updated.stage == DealStage.NEGOTIATION
@pytest.mark.asyncio
async def test_stage_forward_allowed_for_member(session: AsyncSession) -> None:
context, contact, repo = await _persist_base(session, role=OrganizationRole.MEMBER)
service = DealService(repository=repo)
deal = await service.create_deal(
DealCreate(
organization_id=context.organization_id,
contact_id=contact.id,
owner_id=context.user_id,
title="Forward Move",
amount=Decimal("1000"),
),
context=context,
)
updated = await service.update_deal(
deal,
DealUpdateData(stage=DealStage.PROPOSAL),
context=context,
)
assert updated.stage == DealStage.PROPOSAL
@pytest.mark.asyncio
async def test_status_won_requires_positive_amount(session: AsyncSession) -> None:
context, contact, repo = await _persist_base(session)