aboutsummaryrefslogtreecommitdiff
path: root/tests/managers/amt.py
blob: 0b2e5018098cd13191e49a510f41d046516b603a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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