From 9075d9e887a0d5ef8d4a2b66238088d88244d9d2 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Sun, 19 Jan 2025 15:37:44 +0000 Subject: [PATCH] add site factory to new assessment tests - these were passing individually but not when run as a batch --- .../tests/model_tests/test_assessment.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/epilepsy12/tests/model_tests/test_assessment.py b/epilepsy12/tests/model_tests/test_assessment.py index 5f781bd3..f86fbc14 100644 --- a/epilepsy12/tests/model_tests/test_assessment.py +++ b/epilepsy12/tests/model_tests/test_assessment.py @@ -333,6 +333,14 @@ def test_allocate_general_paediatric_centre_to_case_same_organisation_as_lead( ADDENBROOKES = Organisation.objects.get(ods_code="RGT01") # Addenbrookes + site = e12_site_factory( + organisation=ADDENBROOKES, + case=case, + site_is_primary_centre_of_epilepsy_care=True, + site_is_actively_involved_in_epilepsy_care=True, + site_is_general_paediatric_centre=False, + ) + # create a case object assessment = case.registration.assessment @@ -347,6 +355,12 @@ def test_allocate_general_paediatric_centre_to_case_same_organisation_as_lead( case=case, ) + # ensure the site associated with the case is not a general paediatric centre + assert site.organisation == ADDENBROOKES + assert site.site_is_primary_centre_of_epilepsy_care is True + assert site.site_is_actively_involved_in_epilepsy_care is True + assert site.site_is_general_paediatric_centre is False + # update the site model update_site_model( centre_role="general_paediatric_centre", @@ -397,6 +411,14 @@ def test_allocate_general_paediatric_centre_to_case_different_organisation_as_le ADDENBROOKES = Organisation.objects.get(ods_code="RGT01") # Addenbrookes + site = e12_site_factory( + organisation=ADDENBROOKES, + case=case, + site_is_primary_centre_of_epilepsy_care=True, + site_is_actively_involved_in_epilepsy_care=True, + site_is_general_paediatric_centre=False, + ) + # create a case object assessment = case.registration.assessment