aboutsummaryrefslogtreecommitdiff
path: root/tests/models/thl
diff options
context:
space:
mode:
authorstuppie2026-10-05 12:38:37 -0600
committerstuppie2026-10-05 12:38:37 -0600
commit8c6b9cd45fbeb0400f51356e4540943c8d21a886 (patch)
tree924aa437bc8b94e552917634213b81049400684b /tests/models/thl
parente5a3e308a52496ccdc7faf90eec3d9e6aa9918d0 (diff)
downloadgeneralresearch-8c6b9cd45fbeb0400f51356e4540943c8d21a886.tar.gz
generalresearch-8c6b9cd45fbeb0400f51356e4540943c8d21a886.zip
cache balance and user_wallet_balance in redis hash separately for easier bulk retrieval
Diffstat (limited to 'tests/models/thl')
-rw-r--r--tests/models/thl/test_product.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/models/thl/test_product.py b/tests/models/thl/test_product.py
index 5a3e488..e45bd42 100644
--- a/tests/models/thl/test_product.py
+++ b/tests/models/thl/test_product.py
@@ -1174,6 +1174,18 @@ class TestProductCache:
assert p1.balance.retainer_usd_str == "$0.17"
assert p1.balance.available_balance_usd_str == "$0.54"
+ from generalresearch.models.thl.product import (
+ PRODUCT_BALANCES_METRICS_CACHE_KEY,
+ )
+
+ metrics_balance_json = rc.hget(
+ PRODUCT_BALANCES_METRICS_CACHE_KEY,
+ product.uuid,
+ )
+ assert isinstance(metrics_balance_json, str)
+ metrics_balance = ProductBalances.model_validate_json(metrics_balance_json)
+ assert metrics_balance == p1.balance
+
def test_neg_balance_cache(
self,
product: Product,