feat: add UserId value object and update ClassifiedAd to use it
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
from decimal import Decimal
|
||||
from uuid import UUID, uuid4
|
||||
from uuid import uuid4
|
||||
|
||||
from domain.marketplace.classified_ad import ClassifiedAd
|
||||
from domain.marketplace.user_id import UserId
|
||||
|
||||
|
||||
def test_classified_ad_creation():
|
||||
ad_id = uuid4()
|
||||
owner_id = uuid4()
|
||||
owner_id = UserId(value=uuid4())
|
||||
|
||||
ad = ClassifiedAd(
|
||||
id=ad_id,
|
||||
@@ -26,7 +27,7 @@ def test_classified_ad_creation():
|
||||
def test_classified_ad_is_immutable():
|
||||
ad = ClassifiedAd(
|
||||
id=uuid4(),
|
||||
_ownerId=uuid4(),
|
||||
_ownerId=UserId(value=uuid4()),
|
||||
title="Title",
|
||||
text="Text",
|
||||
_price=Decimal("10.00"),
|
||||
@@ -41,7 +42,7 @@ def test_classified_ad_is_immutable():
|
||||
|
||||
def test_classified_ad_equality():
|
||||
ad_id = uuid4()
|
||||
owner_id = uuid4()
|
||||
owner_id = UserId(value=uuid4())
|
||||
|
||||
ad1 = ClassifiedAd(
|
||||
id=ad_id,
|
||||
@@ -58,4 +59,4 @@ def test_classified_ad_equality():
|
||||
_price=Decimal("10.00"),
|
||||
)
|
||||
|
||||
assert ad1 == ad2
|
||||
assert ad1 == ad2
|
||||
|
||||
Reference in New Issue
Block a user