feat: add UserId value object and update ClassifiedAd to use it
This commit is contained in:
25
tests/test_user_id.py
Normal file
25
tests/test_user_id.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from domain.marketplace.user_id import UserId
|
||||
|
||||
|
||||
def test_user_id_creation():
|
||||
user_id = UserId(value=uuid4())
|
||||
assert isinstance(user_id.value, UUID)
|
||||
|
||||
|
||||
def test_user_id_is_immutable():
|
||||
user_id = UserId(value=uuid4())
|
||||
|
||||
try:
|
||||
user_id.value = uuid4() # type: ignore
|
||||
assert False, "Should have raised FrozenInstanceError"
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
def test_user_id_equality():
|
||||
uid = uuid4()
|
||||
user_id1 = UserId(value=uid)
|
||||
user_id2 = UserId(value=uid)
|
||||
assert user_id1 == user_id2
|
||||
Reference in New Issue
Block a user