aboutsummaryrefslogtreecommitdiff
path: root/tests/managers/test_hit.py
blob: 56a4f537eb0e9ad201dad08dd6dc8a71117b5cd0 (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
51
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