1515from eligibility_signposting_api .model .campaign_config import (
1616 AvailableAction ,
1717 CohortLabel ,
18+ CommsRouting ,
1819 Description ,
1920 RuleAttributeLevel ,
2021 RuleAttributeName ,
2122 RuleAttributeTarget ,
2223 RuleComparator ,
2324 RuleName ,
2425 RuleOperator ,
25- RuleType , CommsRouting ,
26+ RuleType ,
2627)
2728from eligibility_signposting_api .model .eligibility_status import (
2829 ActionCode ,
@@ -2354,7 +2355,6 @@ def test_build_condition_results_single_cohort(self, reason_2, expected_reasons)
23542355@pytest .mark .parametrize (
23552356 ("status" , "status_text" , "action_rule" , "action_status_text" , "iteration_status_text" ),
23562357 [
2357-
23582358 # Scenario: Patient is actionable, no Status Text, no override present
23592359 # Expected: Hardcoded value
23602360 pytest .param (
@@ -2515,7 +2515,7 @@ def test_build_condition_results_single_cohort(self, reason_2, expected_reasons)
25152515 ),
25162516 ],
25172517)
2518- def test_configureable_status_text (
2518+ def test_configureable_status_text ( # noqa: PLR0913
25192519 faker : Faker ,
25202520 status : Status ,
25212521 status_text : str ,
@@ -2528,11 +2528,7 @@ def test_configureable_status_text(
25282528 date_of_birth = DateOfBirth (faker .date_of_birth (minimum_age = 85 , maximum_age = 85 ))
25292529
25302530 person_rows = person_rows_builder (
2531- nhs_number ,
2532- date_of_birth = date_of_birth ,
2533- cohorts = ["rsv_cohort_1" ],
2534- icb = "QE1" ,
2535- postcode = "SW19"
2531+ nhs_number , date_of_birth = date_of_birth , cohorts = ["rsv_cohort_1" ], icb = "QE1" , postcode = "SW19"
25362532 )
25372533
25382534 if status == Status .actionable :
@@ -2547,25 +2543,25 @@ def test_configureable_status_text(
25472543
25482544 scenario_rules = [
25492545 rule_builder .PersonAgeSuppressionRuleFactory .build (
2550- type = RuleType .filter ,
2551- name = RuleName ("NotEligible Reason 1" ),
2552- description = RuleText ("NotEligible Description 1" ),
2553- priority = RulePriority ("100" ),
2554- operator = RuleOperator .year_lte ,
2555- attribute_level = RuleAttributeLevel .PERSON ,
2556- attribute_name = RuleAttributeName ("DATE_OF_BIRTH" ),
2557- comparator = RuleComparator (filter_comparator ),
2558- ),
2546+ type = RuleType .filter ,
2547+ name = RuleName ("NotEligible Reason 1" ),
2548+ description = RuleText ("NotEligible Description 1" ),
2549+ priority = RulePriority ("100" ),
2550+ operator = RuleOperator .year_lte ,
2551+ attribute_level = RuleAttributeLevel .PERSON ,
2552+ attribute_name = RuleAttributeName ("DATE_OF_BIRTH" ),
2553+ comparator = RuleComparator (filter_comparator ),
2554+ ),
25592555 rule_builder .PersonAgeSuppressionRuleFactory .build (
2560- type = RuleType .suppression ,
2561- name = RuleName ("NotActionable Reason 1" ),
2562- description = RuleText ("NotActionable Description 1" ),
2563- priority = RulePriority ("110" ),
2564- operator = RuleOperator .year_lte ,
2565- attribute_level = RuleAttributeLevel .PERSON ,
2566- attribute_name = RuleAttributeName ("DATE_OF_BIRTH" ),
2567- comparator = RuleComparator (suppression_comparator ),
2568- ),
2556+ type = RuleType .suppression ,
2557+ name = RuleName ("NotActionable Reason 1" ),
2558+ description = RuleText ("NotActionable Description 1" ),
2559+ priority = RulePriority ("110" ),
2560+ operator = RuleOperator .year_lte ,
2561+ attribute_level = RuleAttributeLevel .PERSON ,
2562+ attribute_name = RuleAttributeName ("DATE_OF_BIRTH" ),
2563+ comparator = RuleComparator (suppression_comparator ),
2564+ ),
25692565 action_rule ,
25702566 ]
25712567 campaign_configs = [
@@ -2574,16 +2570,15 @@ def test_configureable_status_text(
25742570 iterations = [
25752571 rule_builder .IterationFactory .build (
25762572 status_text = iteration_status_text ,
2577-
25782573 iteration_cohorts = [
25792574 rule_builder .IterationCohortFactory .build (
25802575 cohort_label = "rsv_cohort_1" , cohort_group = "rsv_cohort_group" , priority = 0
25812576 ),
25822577 ],
25832578 iteration_rules = scenario_rules ,
2584-
25852579 actions_mapper = rule_builder .ActionsMapperFactory .build (
2586- root = {"STATUS_TEXT_OVERRIDE" : action_status_text }),
2580+ root = {"STATUS_TEXT_OVERRIDE" : action_status_text }
2581+ ),
25872582 )
25882583 ],
25892584 )
@@ -2603,11 +2598,9 @@ def test_configureable_status_text(
26032598 .and_status (status )
26042599 .and_status_text (StatusText (status_text ))
26052600 )
2606- )
2601+ ),
26072602 )
2608- assert_that (
2609- actual .conditions [0 ].actions ,
2610- is_ ([]))
2603+ assert_that (actual .conditions [0 ].actions , is_ ([]))
26112604
26122605
26132606def test_configureable_status_text_exclude_actions (faker : Faker ):
@@ -2639,7 +2632,6 @@ def test_configureable_status_text_exclude_actions(faker: Faker):
26392632 NotActionable = "Orignal you are not actionable status text" ,
26402633 Actionable = "Orignal you are actionable status text" ,
26412634 ),
2642-
26432635 iteration_cohorts = [
26442636 rule_builder .IterationCohortFactory .build (
26452637 cohort_label = "rsv_cohort_1" , cohort_group = "rsv_cohort_group" , priority = 0
@@ -2656,7 +2648,6 @@ def test_configureable_status_text_exclude_actions(faker: Faker):
26562648 attribute_name = RuleAttributeName ("DATE_OF_BIRTH" ),
26572649 comparator = RuleComparator ("-90" ),
26582650 ),
2659-
26602651 rule_builder .PersonAgeSuppressionRuleFactory .build (
26612652 type = RuleType .suppression ,
26622653 name = RuleName ("NotActionable Reason 1" ),
@@ -2670,11 +2661,10 @@ def test_configureable_status_text_exclude_actions(faker: Faker):
26702661 rule_builder .ICBRedirectRuleFactory .build (
26712662 comms_routing = CommsRouting ("STATUS_TEXT_OVERRIDE_ACTIONABLE" )
26722663 ),
2673-
26742664 ],
2675-
26762665 actions_mapper = rule_builder .ActionsMapperFactory .build (
2677- root = {"STATUS_TEXT_OVERRIDE_ACTIONABLE" : action_status_text_override_actionable }),
2666+ root = {"STATUS_TEXT_OVERRIDE_ACTIONABLE" : action_status_text_override_actionable }
2667+ ),
26782668 )
26792669 ],
26802670 )
@@ -2693,13 +2683,15 @@ def test_configureable_status_text_exclude_actions(faker: Faker):
26932683 .with_condition_name (ConditionName ("RSV" ))
26942684 .and_status (Status .actionable )
26952685 .and_status_text (StatusText ("Orignal you are actionable status text" ))
2696-
2697- )))
2686+ )
2687+ ),
2688+ )
26982689 assert_that (
26992690 actual .conditions [0 ].actions ,
27002691 is_ (None ),
27012692 )
27022693
2694+
27032695def test_configureable_status_text_multiple_actions (faker : Faker ):
27042696 # Patient is actionable and there are multiple actions. Testing override does not change action
27052697 # Given
@@ -2735,7 +2727,6 @@ def test_configureable_status_text_multiple_actions(faker: Faker):
27352727 NotActionable = "Orignal you are not actionable status text" ,
27362728 Actionable = "Orignal you are actionable status text" ,
27372729 ),
2738-
27392730 iteration_cohorts = [
27402731 rule_builder .IterationCohortFactory .build (
27412732 cohort_label = "rsv_cohort_1" , cohort_group = "rsv_cohort_group" , priority = 0
@@ -2752,7 +2743,6 @@ def test_configureable_status_text_multiple_actions(faker: Faker):
27522743 attribute_name = RuleAttributeName ("DATE_OF_BIRTH" ),
27532744 comparator = RuleComparator ("-90" ),
27542745 ),
2755-
27562746 rule_builder .PersonAgeSuppressionRuleFactory .build (
27572747 type = RuleType .suppression ,
27582748 name = RuleName ("NotActionable Reason 1" ),
@@ -2766,14 +2756,13 @@ def test_configureable_status_text_multiple_actions(faker: Faker):
27662756 rule_builder .ICBRedirectRuleFactory .build (
27672757 comms_routing = CommsRouting ("STATUS_TEXT_OVERRIDE_ACTIONABLE|BOOK_NBS" )
27682758 ),
2769-
27702759 ],
2771-
27722760 actions_mapper = rule_builder .ActionsMapperFactory .build (
27732761 root = {
27742762 "STATUS_TEXT_OVERRIDE_ACTIONABLE" : action_status_text_override_actionable ,
27752763 "BOOK_NBS" : action_book_nbs ,
2776- }),
2764+ }
2765+ ),
27772766 )
27782767 ],
27792768 )
@@ -2792,8 +2781,9 @@ def test_configureable_status_text_multiple_actions(faker: Faker):
27922781 .with_condition_name (ConditionName ("RSV" ))
27932782 .and_status (Status .actionable )
27942783 .and_status_text (StatusText ("Status Text Override Actionable" ))
2795-
2796- )))
2784+ )
2785+ ),
2786+ )
27972787 assert_that (len (actual .conditions [0 ].actions ), is_ (1 ))
27982788 assert_that (actual .conditions [0 ].actions [0 ].action_code , is_ (ActionCode ("BookNBS" )))
2799- assert_that (actual .conditions [0 ].actions [0 ].internal_action_code , is_ (InternalActionCode ("BOOK_NBS" )))
2789+ assert_that (actual .conditions [0 ].actions [0 ].internal_action_code , is_ (InternalActionCode ("BOOK_NBS" )))
0 commit comments