aboutsummaryrefslogtreecommitdiff
path: root/tests/models/thl
diff options
context:
space:
mode:
authorMax Nanis2026-09-02 23:31:52 -0700
committerMax Nanis2026-09-02 23:31:52 -0700
commit17ff15c06655717627da820417337c6b0b97de42 (patch)
tree0cea68d654991b3742ba7447626c5e9ee639285a /tests/models/thl
parentd36994dd21a2bc025188a1ab58334915221f22cc (diff)
downloadgeneralresearch-17ff15c06655717627da820417337c6b0b97de42.tar.gz
generalresearch-17ff15c06655717627da820417337c6b0b97de42.zip
Lots more tests/managers/thl - doing all the factory organization from create_dummy
Diffstat (limited to 'tests/models/thl')
-rw-r--r--tests/models/thl/test_product.py6
-rw-r--r--tests/models/thl/test_user.py10
2 files changed, 12 insertions, 4 deletions
diff --git a/tests/models/thl/test_product.py b/tests/models/thl/test_product.py
index 446b59f..f1050bb 100644
--- a/tests/models/thl/test_product.py
+++ b/tests/models/thl/test_product.py
@@ -64,9 +64,11 @@ class TestProduct:
# We're not excluding anything here, only in the "*Out" variants
assert "id_int" in res
- def test_init_db(self, product_manager: ProductManager):
+ def test_init_db(
+ self, product_factory: Callable[..., Product], product_manager: ProductManager
+ ):
# By default, just a Pydantic instance doesn't have an id_int
- instance = product_manager.create_dummy()
+ instance = product_factory()
assert isinstance(instance.id_int, int)
res = instance.model_dump_json()
diff --git a/tests/models/thl/test_user.py b/tests/models/thl/test_user.py
index bc941d4..68b413c 100644
--- a/tests/models/thl/test_user.py
+++ b/tests/models/thl/test_user.py
@@ -18,6 +18,7 @@ if TYPE_CHECKING:
from generalresearch.managers.thl.ledger_manager.thl_ledger import ThlLedgerManager
from generalresearch.managers.thl.userhealth import AuditLogManager
from generalresearch.models.thl.product import Product
+ from generalresearch.models.thl.userhealth import AuditLog
class TestUserUserID:
@@ -621,12 +622,17 @@ class TestUserSerialization:
class TestUserMethods:
- def test_audit_log(self, user: User, audit_log_manager: AuditLogManager):
+ def test_audit_log(
+ self,
+ audit_log_factory: Callable[..., AuditLog],
+ user: User,
+ audit_log_manager: AuditLogManager,
+ ):
assert user.audit_log is None
user.prefetch_audit_log(audit_log_manager=audit_log_manager)
assert user.audit_log == []
- audit_log_manager.create_dummy(user_id=user.user_id)
+ audit_log_factory(user_id=user.user_id)
user.prefetch_audit_log(audit_log_manager=audit_log_manager)
assert len(user.audit_log) == 1