aboutsummaryrefslogtreecommitdiff
path: root/tests/managers/thl/test_product_prod.py
diff options
context:
space:
mode:
authorstuppie2026-09-07 11:47:43 -0600
committerstuppie2026-09-07 11:47:43 -0600
commit092960233652cce1f4dc7841856034a6635e9cd9 (patch)
tree46e5fcd4d1e1b7ed0b987980c6c67ffa6e6b45c7 /tests/managers/thl/test_product_prod.py
parent80fd8aab4c7271ddb619b0de18741d7ac77b490b (diff)
parent242579a44855873d5e054e375440e9d3492cd682 (diff)
downloadgeneralresearch-092960233652cce1f4dc7841856034a6635e9cd9.tar.gz
generalresearch-092960233652cce1f4dc7841856034a6635e9cd9.zip
Merge branch 'master' into dev-greg
Diffstat (limited to 'tests/managers/thl/test_product_prod.py')
-rw-r--r--tests/managers/thl/test_product_prod.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/managers/thl/test_product_prod.py b/tests/managers/thl/test_product_prod.py
index 7b4f677..d584527 100644
--- a/tests/managers/thl/test_product_prod.py
+++ b/tests/managers/thl/test_product_prod.py
@@ -1,17 +1,25 @@
+from __future__ import annotations
+
import logging
+from collections.abc import Callable
+from typing import TYPE_CHECKING
from uuid import uuid4
import pytest
from generalresearch.models.thl.product import Product
-from test_utils.models.conftest import product_factory
+
+if TYPE_CHECKING:
+ from generalresearch.managers.thl.product import ProductManager
logger = logging.getLogger()
class TestProductManagerGetMethods:
- def test_get_by_uuid(self, product_manager, product_factory):
+ def test_get_by_uuid(
+ self, product_manager: ProductManager, product_factory: Callable[..., Product]
+ ):
# Just test that we load properly
for p in [product_factory(), product_factory(), product_factory()]:
instance = product_manager.get_by_uuid(product_uuid=p.id)
@@ -23,7 +31,9 @@ class TestProductManagerGetMethods:
product_manager.get_by_uuid(product_uuid=uuid4().hex)
assert "product not found" in str(cm.value)
- def test_get_by_uuids(self, product_manager, product_factory):
+ def test_get_by_uuids(
+ self, product_manager: ProductManager, product_factory: Callable[..., Product]
+ ):
products = [product_factory(), product_factory(), product_factory()]
cnt = len(products)
res = product_manager.get_by_uuids(product_uuids=[p.id for p in products])
@@ -43,7 +53,9 @@ class TestProductManagerGetMethods:
)
assert "invalid uuid passed" in str(cm.value)
- def test_get_by_uuid_if_exists(self, product_factory, product_manager):
+ def test_get_by_uuid_if_exists(
+ self, product_factory: Callable[..., Product], product_manager: ProductManager
+ ):
products = [product_factory(), product_factory(), product_factory()]
instance = product_manager.get_by_uuid_if_exists(product_uuid=products[0].id)
@@ -52,7 +64,9 @@ class TestProductManagerGetMethods:
instance = product_manager.get_by_uuid_if_exists(product_uuid="abc123")
assert instance is None
- def test_get_by_uuids_if_exists(self, product_manager, product_factory):
+ def test_get_by_uuids_if_exists(
+ self, product_manager: ProductManager, product_factory: Callable[..., Product]
+ ):
products = [product_factory(), product_factory(), product_factory()]
res = product_manager.get_by_uuids_if_exists(
@@ -75,8 +89,7 @@ class TestProductManagerGetMethods:
class TestProductManagerGetAll:
@pytest.mark.skip(reason="TODO")
- def test_get_ALL_by_ids(self, product_manager):
+ def test_get_ALL_by_ids(self, product_manager: ProductManager):
products = product_manager.get_all(rand_limit=50)
logger.info(f"Fetching {len(products)} product uuids")
# todo: once timebucks stops spamming broken accounts, fetch more
- pass