blob: d7aa458a02c1f4e7ffa86bc5cee995854d8247c8 (
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
|
import pytest
from engagements.utils import populate_database
from engagements.models import RegulatoryCycle
pytestmark = pytest.mark.django_db
@pytest.fixture
def data():
return populate_database()
def test_check_all_dcs(data):
dscs = data.get("sub_instruments")
assert dscs[0].title == "DSC 1 - Title 1"
def test_effort_by_type(data):
e = data["engagements"][0]
total_planning = sum([x.effort_total_planned_hours() for x in e.effort.filter(effort_type="PLANNING")])
total_travel = sum([x.effort_total_planned_hours() for x in e.effort.filter(effort_type="TRAVEL")])
total_regulation = sum([x.effort_total_planned_hours() for x in e.effort.filter(effort_type="REGULATION")])
assert total_planning == 4.25
assert total_regulation == 0
assert total_travel == 1
@pytest.mark.skip(reason="Not implemented until I get my head round effort calculations")
def test_total_effort_for_engagement(data):
e = data["engagements"][0]
assert e.total_effort() == 5.25
def test_regulatory_cycle_model(regulatory_cycles):
rc = RegulatoryCycle.objects.first()
rc2023 = RegulatoryCycle.objects.get(start_date="2023-01-01")
assert str(rc) == "Regulatory Cycle: 2024"
assert str(rc2023) == "Regulatory Cycle: 2023"
# def test_engagement_strategy_model(data):
# assert EngagementStrategy.objects.first()
|