diff options
| author | Max Nanis | 2026-02-24 17:26:15 -0500 |
|---|---|---|
| committer | Max Nanis | 2026-02-24 17:26:15 -0500 |
| commit | 8c1940445503fd6678d0961600f2be81622793a2 (patch) | |
| tree | b9173562b8824b5eaa805e446d9d780e1f23fb2a /tests/managers | |
| parent | 25d8c3c214baf10f6520cc1351f78473150e5d7a (diff) | |
| download | amt-jb-8c1940445503fd6678d0961600f2be81622793a2.tar.gz amt-jb-8c1940445503fd6678d0961600f2be81622793a2.zip | |
Extensive use of type checking. Movement of pytest conf towards handling managers (for db agnostic unittest). Starting to organize pytests.
Diffstat (limited to 'tests/managers')
| -rw-r--r-- | tests/managers/amt.py | 9 | ||||
| -rw-r--r-- | tests/managers/hit.py | 19 |
2 files changed, 17 insertions, 11 deletions
diff --git a/tests/managers/amt.py b/tests/managers/amt.py index 0b2e501..a847582 100644 --- a/tests/managers/amt.py +++ b/tests/managers/amt.py @@ -1,4 +1,3 @@ -from jb.decorators import HTM, HM, HQM from jb.managers.amt import AMTManager @@ -8,16 +7,16 @@ def test_create_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) +def test_create_hit_with_hit_type(hqm, htm, hm, 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 + 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) + hm.create(hit) assert hit.id is not None diff --git a/tests/managers/hit.py b/tests/managers/hit.py index 8fcd673..cb2b35a 100644 --- a/tests/managers/hit.py +++ b/tests/managers/hit.py @@ -1,18 +1,25 @@ -from jb.decorators import HTM +from jb.models import Question + + +class TestHitQuestionManager: + + def test_base(self, question_record): + assert isinstance(question_record, Question) + assert question_record.id is None class TestHitTypeManager: - def test_create(self, hit_type_with_amt_id): + def test_create(self, htm, hit_type_with_amt_id): assert hit_type_with_amt_id.id is None - HTM.create(hit_type_with_amt_id) + htm.create(hit_type_with_amt_id) assert hit_type_with_amt_id.id is not None - res = HTM.filter_active() + 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) + htm.set_min_active(hit_type_with_amt_id) - res = HTM.filter_active() + res = htm.filter_active() assert len(res) == 0 |
