From 5fb0621c53967bf24f4411f579712223e96b296a Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 10 Sep 2024 12:11:12 +0100 Subject: Adds RegulatoryCycle model --- engagements/tests/conftest.py | 11 ++++++++++- engagements/tests/test_models.py | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'engagements/tests') 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,9 +1,18 @@ 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 = { 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() -- cgit v1.2.3