summaryrefslogblamecommitdiffstats
path: root/engagements/tests/test_models.py
blob: 73738db5cf74847f54162719cf45ef3a13bc3b68 (plain) (tree)
1
2
3
4
5
             



                                               


























                                                                                                               
import pytest

from engagements.utils import populate_database


@pytest.fixture
@pytest.mark.django_db
def data():
    return populate_database()


@pytest.mark.django_db
def test_check_all_dcs(data):
    dscs = data.get("sub_instruments")
    assert dscs[0].title == "DSC 1 - Title 1"


@pytest.mark.django_db
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