summaryrefslogtreecommitdiff
path: root/tests/managers
diff options
context:
space:
mode:
authorMax Nanis2026-02-19 02:43:23 -0500
committerMax Nanis2026-02-19 02:43:23 -0500
commitf0f96f83c2630e890a2cbcab53f77fd4c37e1684 (patch)
treec6d2cb092e76bf5d499e0ea9949508d6b22164fd /tests/managers
parent3eaa56f0306ead818f64c3d99fc6d230d9b970a4 (diff)
downloadamt-jb-master.tar.gz
amt-jb-master.zip
Models, Project files, some pytests, requirements.. etcHEADmaster
Diffstat (limited to 'tests/managers')
-rw-r--r--tests/managers/__init__.py0
-rw-r--r--tests/managers/amt.py23
-rw-r--r--tests/managers/hit.py18
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/managers/__init__.py b/tests/managers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/managers/__init__.py
diff --git a/tests/managers/amt.py b/tests/managers/amt.py
new file mode 100644
index 0000000..0b2e501
--- /dev/null
+++ b/tests/managers/amt.py
@@ -0,0 +1,23 @@
+from jb.decorators import HTM, HM, HQM
+from jb.managers.amt import AMTManager
+
+
+def test_create_hit_type(hit_type):
+ assert hit_type.amt_hit_type_id is None
+ AMTManager.create_hit_type(hit_type=hit_type)
+ assert hit_type.amt_hit_type_id is not None
+
+
+def test_create_hit_with_hit_type(hit_type_with_amt_id, question):
+ question = HQM.get_or_create(question)
+
+ hit_type = hit_type_with_amt_id
+ hit_type = [
+ x for x in HTM.filter_active() if x.amt_hit_type_id == hit_type.amt_hit_type_id
+ ][0]
+
+ hit = AMTManager.create_hit_with_hit_type(hit_type=hit_type, question=question)
+ assert hit.amt_hit_id is not None
+ assert hit.id is None
+ HM.create(hit)
+ assert hit.id is not None
diff --git a/tests/managers/hit.py b/tests/managers/hit.py
new file mode 100644
index 0000000..8fcd673
--- /dev/null
+++ b/tests/managers/hit.py
@@ -0,0 +1,18 @@
+from jb.decorators import HTM
+
+
+class TestHitTypeManager:
+
+ def test_create(self, hit_type_with_amt_id):
+ assert hit_type_with_amt_id.id is None
+ HTM.create(hit_type_with_amt_id)
+ assert hit_type_with_amt_id.id is not None
+
+ res = HTM.filter_active()
+ assert len(res) == 1
+
+ hit_type_with_amt_id.min_active = 0
+ HTM.set_min_active(hit_type_with_amt_id)
+
+ res = HTM.filter_active()
+ assert len(res) == 0