diff options
Diffstat (limited to 'engagements/tests')
-rw-r--r-- | engagements/tests/conftest.py | 11 | ||||
-rw-r--r-- | engagements/tests/test_models.py | 12 |
2 files changed, 22 insertions, 1 deletions
diff --git a/engagements/tests/conftest.py b/engagements/tests/conftest.py index cb0b9e0..72f1c11 100644 --- a/engagements/tests/conftest.py +++ b/engagements/tests/conftest.py @@ -1,10 +1,19 @@ import pytest -from engagements.models import EngagementType, Organisation, Engagement +from datetime import date + +from engagements.models import EngagementType, Organisation, Engagement, 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 engagement(): data = { "proposed_start_date": "2022-10-01", diff --git a/engagements/tests/test_models.py b/engagements/tests/test_models.py index 3b84ead..d7aa458 100644 --- a/engagements/tests/test_models.py +++ b/engagements/tests/test_models.py @@ -1,6 +1,7 @@ import pytest from engagements.utils import populate_database +from engagements.models import RegulatoryCycle pytestmark = pytest.mark.django_db @@ -29,3 +30,14 @@ def test_effort_by_type(data): 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() |