aboutsummaryrefslogtreecommitdiff
path: root/tests/managers/test_hit.py
blob: 974bd18bd79b71aa62a226b48195dad54ac4401a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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: HitType):

        assert isinstance(hit_type_record.id, int)
        assert isinstance(hit_type_record.amt_hit_type_id, str)

        count1 = len(htm.filter_active())
        # assert count1 == 1

        hit_type_record.min_active = 0
        htm.set_min_active(hit_type=hit_type_record)

        count2 = len(htm.filter_active())
        assert count1 - 1 == count2


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