summaryrefslogtreecommitdiffstats
path: root/engagements/tests/conftest.py
diff options
context:
space:
mode:
authorYulqen <246857+yulqen@users.noreply.github.com>2024-09-10 15:58:55 +0100
committerGitHub <noreply@github.com>2024-09-10 15:58:55 +0100
commitdcfe6d87098bbe064d2db268f0972865c3d412bf (patch)
tree2b82df07a5290f80f25e9780596cbce0f128454f /engagements/tests/conftest.py
parent7ddc22b821f405546786977225e7b194a19b2b77 (diff)
parent15b2dc965bfe2271d73476fcf9ff636c60113908 (diff)
Merge pull request #106 from defencedigital/postgres-migration
Adds new Engagement Strategy stuff
Diffstat (limited to 'engagements/tests/conftest.py')
-rw-r--r--engagements/tests/conftest.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/engagements/tests/conftest.py b/engagements/tests/conftest.py
new file mode 100644
index 0000000..7ccb9ad
--- /dev/null
+++ b/engagements/tests/conftest.py
@@ -0,0 +1,68 @@
+from datetime import date
+
+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):
+ es = 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")