test: add unit tests for roles, web deps, use cases, VO boundaries — reach 70% coverage
Some checks failed
ci/woodpecker/pr/pipeline Pipeline failed
Some checks failed
ci/woodpecker/pr/pipeline Pipeline failed
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Tests for domain entities."""
|
||||
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from app.domain.entities import Post
|
||||
@@ -126,3 +127,19 @@ class TestPost:
|
||||
assert "id" in data
|
||||
assert "created_at" in data
|
||||
assert "updated_at" in data
|
||||
|
||||
def test_base_entity_eq_and_hash(self) -> None:
|
||||
"""Test BaseEntity equality and hash directly."""
|
||||
from app.domain.entities.base import BaseEntity
|
||||
|
||||
class ConcreteEntity(BaseEntity):
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return {}
|
||||
|
||||
e1 = ConcreteEntity()
|
||||
e2 = ConcreteEntity()
|
||||
e2.id = e1.id
|
||||
|
||||
assert BaseEntity.__eq__(e1, e2) is True
|
||||
assert BaseEntity.__eq__(e1, "not an entity") == NotImplemented
|
||||
assert BaseEntity.__hash__(e1) == hash(e1.id)
|
||||
|
||||
Reference in New Issue
Block a user