summaryrefslogtreecommitdiffstats
path: root/engagements/tests/conftest.py
blob: 74e41eb3db276afbf5e0650f5ea68415f76f27ae (plain) (blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import pytest

from engagements.models import Engagement, EngagementStrategy, EngagementType, Organisation, RegulatoryCycle
from myuser.models import TeamUser


@pytest.fixture
def regulatory_cycles():
    RegulatoryCycle.objects.create(start_date="2024-01-01", end_date="2024-12-31")
    RegulatoryCycle.objects.create(start_date="2023-01-01", end_date="2023-12-31")
    RegulatoryCycle.objects.create(start_date="2022-01-01", end_date="2022-12-31")


@pytest.fixture
def org():
    return Organisation.objects.create(name="MOD", is_regulated_entity=False)


@pytest.fixture
def engagement_strategy(regulatory_cycles, org, user):
    EngagementStrategy.objects.create(
        description="ES1 description",
        start_year=RegulatoryCycle.objects.get(start_date="2022-01-01"),
        end_year=RegulatoryCycle.objects.get(start_date="2024-01-01"),
        organisation=org,
        owned_by=user,
        reviewed_by=user,
        management_sign_off="2022-02-10",
        inspector_sign_off="2022-01-10",
        status="DRAFT",
    )


@pytest.fixture
def engagement():
    data = {
        "proposed_start_date": "2022-10-01",
        "engagement_type": EngagementType.objects.create(name="ET1"),
        "external_party": Organisation.objects.create(name="O1"),
    }
    return Engagement.objects.create(**data)


@pytest.fixture
def user():
    return TeamUser.objects.create_user(email="ming@ming.com")


@pytest.fixture
def engagement_type():
    return EngagementType.objects.create(name="ET2")


@pytest.fixture
def external_party():
    return Organisation.objects.create(name="O2")


@pytest.fixture
def user1():
    return TeamUser.objects.create_user(email="user1@example.com")


@pytest.fixture
def user2():
    return TeamUser.objects.create_user(email="user2@example.com")