26 lines
565 B
Python
26 lines
565 B
Python
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
|