aboutsummaryrefslogtreecommitdiff
path: root/tests_sandbox/test_flow.py
diff options
context:
space:
mode:
authorMax Nanis2026-02-19 20:11:41 -0500
committerMax Nanis2026-02-19 20:11:41 -0500
commit8b31678c6e44400967d4934cd9f3c6c6ac0da721 (patch)
tree41c5f4479c353a16da1a8b6fa9088abd084ea388 /tests_sandbox/test_flow.py
parentf0f96f83c2630e890a2cbcab53f77fd4c37e1684 (diff)
downloadamt-jb-8b31678c6e44400967d4934cd9f3c6c6ac0da721.tar.gz
amt-jb-8b31678c6e44400967d4934cd9f3c6c6ac0da721.zip
Carer dir into project, some initial pytest, part of the flow tasks. License and Readme update
Diffstat (limited to 'tests_sandbox/test_flow.py')
-rw-r--r--tests_sandbox/test_flow.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests_sandbox/test_flow.py b/tests_sandbox/test_flow.py
new file mode 100644
index 0000000..7925d92
--- /dev/null
+++ b/tests_sandbox/test_flow.py
@@ -0,0 +1,29 @@
+from jb.decorators import HM
+from jb.flow.tasks import refill_hits, check_stale_hits, check_expired_hits
+
+
+def test_refill_hits(
+ set_hit_types_in_db_min_active_0, hit_type_in_db, expire_all_hits, amt_manager
+):
+
+ assert HM.get_active_count(hit_type_in_db.id) == 0
+ assert hit_type_in_db.min_active > 0
+ refill_hits()
+ assert HM.get_active_count(hit_type_in_db.id) == hit_type_in_db.min_active
+
+ amt_hit_ids = HM.filter_active_ids(hit_type_id=hit_type_in_db.id)
+ amt_hit_id = list(amt_hit_ids)[0]
+ hit, _ = amt_manager.get_hit_if_exists(amt_hit_id=amt_hit_id)
+ assert hit
+
+
+def test_check_stale_hits():
+ # todo: I'd have to create some purposely stale hits.
+ # just make sure it runs for now
+ check_stale_hits()
+
+
+def test_check_expired_hits():
+ # todo: I'd have to create some purposely expired hits.
+ # just make sure it runs for now
+ check_expired_hits()