diff options
Diffstat (limited to 'tests/managers/test_hit.py')
| -rw-r--r-- | tests/managers/test_hit.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/managers/test_hit.py b/tests/managers/test_hit.py new file mode 100644 index 0000000..56a4f53 --- /dev/null +++ b/tests/managers/test_hit.py @@ -0,0 +1,52 @@ +from jb.models.hit import HitQuestion, HitType, Hit +from jb.managers.hit import HitTypeManager, HitManager + + +class TestHitQuestionManager: + + def test_base(self, question_record: HitQuestion): + assert isinstance(question_record, HitQuestion) + assert isinstance(question_record.id, int) + + +class TestHitTypeManager: + + def test_create(self, htm: HitTypeManager, hit_type_record_with_amt_id: HitType): + + _ = hit_type_record_with_amt_id + + assert isinstance(hit_type_record_with_amt_id.id, int) + assert isinstance(hit_type_record_with_amt_id.amt_hit_type_id, str) + + count1 = len(htm.filter_active()) + # assert count1 == 1 + + hit_type_record_with_amt_id.min_active = 0 + htm.set_min_active(hit_type=hit_type_record_with_amt_id) + + count2 = len(htm.filter_active()) + assert count2 == 0 + + +class TestHitManager: + + # def test_create + + # def update_status + + # def update_hit + + # def get_from_amt_id + + # get_from_amt_id_if_exists + + def test_get_active_count(self, hm: HitManager, hit_record: Hit): + + count = hm.get_active_count(hit_type_id=999_999_999) + assert isinstance(count, int) + assert count == 0 + + count = hm.get_active_count(hit_type_id=hit_record.hit_type_id) + assert count == 1 + + # filter_active_ids |
