2121 SurveillanceDueDateReason ,
2222)
2323from datetime import datetime
24+ from typing import Any
2425
2526
2627@pytest .fixture (scope = "function" , autouse = True )
@@ -37,6 +38,18 @@ def before_each(page: Page):
3738 base_page .go_to_screening_subject_search_page ()
3839
3940
41+ @pytest .fixture
42+ def base_expected_db () -> dict [str , Any ]:
43+ return {
44+ "Screening Status" : ScreeningStatus .CEASED ,
45+ "Screening Due Date" : EXPECT .NULL ,
46+ "Ceased Confirmation Details" : "AUTO TEST: notes" ,
47+ "Clinical Reason for Cease" : EXPECT .NULL ,
48+ "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
49+ "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
50+ }
51+
52+
4053# Feature: Manually cease a subject
4154
4255
@@ -45,7 +58,9 @@ def before_each(page: Page):
4558@pytest .mark .vpn_required
4659@pytest .mark .manual_cease
4760@pytest .mark .regression
48- def test_manual_cease_from_inactive_subject_for_informed_dissent (page : Page ) -> None :
61+ def test_manual_cease_from_inactive_subject_for_informed_dissent (
62+ page : Page , base_expected_db
63+ ) -> None :
4964 """
5065 Scenario: Subject is at status Inactive, cease for Informed Dissent
5166
@@ -121,16 +136,11 @@ def test_manual_cease_from_inactive_subject_for_informed_dissent(page: Page) ->
121136
122137 # DB assertions
123138 expected_db = {
124- "Screening Status" : ScreeningStatus . CEASED ,
139+ ** base_expected_db ,
125140 "Screening Status Reason" : ScreeningStatusReason .INFORMED_DISSENT ,
126141 "Screening Status Date of Change" : EXPECT .TODAY ,
127142 "Screening Due Date Reason" : ScreeningDueDateReason .CEASED ,
128- "Screening Due Date" : EXPECT .NULL ,
129- "Ceased Confirmation Details" : ("AUTO TEST: notes" ),
130- "Clinical Reason for Cease" : EXPECT .NULL ,
131- "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
132143 "Calculated Lynch Due Date" : EXPECT .UNCHANGED ,
133- "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
134144 }
135145
136146 # Fire off the DB asserts
@@ -142,7 +152,7 @@ def test_manual_cease_from_inactive_subject_for_informed_dissent(page: Page) ->
142152@pytest .mark .manual_cease
143153@pytest .mark .regression
144154def test_manual_cease_from_call_subject_for_informed_dissent_verbal_only (
145- page : Page ,
155+ page : Page , base_expected_db
146156) -> None :
147157 """
148158 Scenario: Subject is at status Call, cease for Informed Dissent, verbal only
@@ -227,23 +237,18 @@ def test_manual_cease_from_call_subject_for_informed_dissent_verbal_only(
227237
228238 # DB assertions
229239 expected_db = {
240+ ** base_expected_db ,
230241 "Screening Status" : ScreeningStatus .CEASED ,
231242 "Screening Status Reason" : ScreeningStatusReason .INFORMED_DISSENT_VERBAL ,
232243 "Screening Status Date of Change" : EXPECT .TODAY ,
233244 "Screening Due Date Reason" : ScreeningDueDateReason .CEASED ,
234245 "Screening Due Date" : EXPECT .NULL ,
235246 "Ceased Confirmation Details" : "AUTO TEST: notes" ,
236247 "Clinical Reason for Cease" : EXPECT .NULL ,
237- "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
238248 "Calculated Lynch Due Date" : EXPECT .NULL ,
239- "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
240249 "Lynch due date" : EXPECT .NULL ,
241- "Lynch due date reason" : EXPECT .UNCHANGED ,
242- "Lynch due date date of change" : EXPECT .UNCHANGED ,
243250 "Screening due date date of change" : EXPECT .TODAY ,
244251 "Surveillance due date" : EXPECT .NULL ,
245- "Surveillance due date reason" : EXPECT .UNCHANGED ,
246- "Surveillance due date date of change" : EXPECT .UNCHANGED ,
247252 }
248253
249254 # Fire off the DB asserts
@@ -255,7 +260,7 @@ def test_manual_cease_from_call_subject_for_informed_dissent_verbal_only(
255260@pytest .mark .manual_cease
256261@pytest .mark .regression
257262def test_manual_cease_from_recall_subject_for_no_colon_subject_request (
258- page : Page ,
263+ page : Page , base_expected_db
259264) -> None :
260265 """
261266 Scenario: Subject is at status Recall, cease for No Colon, subject request
@@ -339,23 +344,15 @@ def test_manual_cease_from_recall_subject_for_no_colon_subject_request(
339344
340345 # DB field assertions
341346 expected_db = {
347+ ** base_expected_db ,
342348 "Screening Status" : ScreeningStatus .CEASED ,
343349 "Screening Status Reason" : ScreeningStatusReason .NO_COLON_SUBJECT_REQUEST ,
344350 "Screening Status Date of Change" : EXPECT .TODAY ,
345- "Screening Due Date Reason" : ScreeningDueDateReason .CEASED ,
346351 "Screening Due Date" : EXPECT .NULL ,
352+ "Screening Due Date Reason" : ScreeningDueDateReason .CEASED ,
347353 "Screening due date date of change" : EXPECT .TODAY ,
348354 "Ceased Confirmation Details" : "AUTO TEST: notes" ,
349355 "Clinical Reason for Cease" : EXPECT .NULL ,
350- "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
351- "Calculated Lynch Due Date" : EXPECT .NULL ,
352- "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
353- "Lynch due date" : EXPECT .NULL ,
354- "Lynch due date reason" : EXPECT .UNCHANGED ,
355- "Lynch due date date of change" : EXPECT .UNCHANGED ,
356- "Surveillance due date" : EXPECT .NULL ,
357- "Surveillance due date reason" : EXPECT .UNCHANGED ,
358- "Surveillance due date date of change" : EXPECT .UNCHANGED ,
359356 }
360357
361358 # Fire off the DB assertions
@@ -367,7 +364,7 @@ def test_manual_cease_from_recall_subject_for_no_colon_subject_request(
367364@pytest .mark .manual_cease
368365@pytest .mark .regression
369366def test_manual_cease_from_surveillance_subject_for_no_colon_programme_assessed (
370- page : Page ,
367+ page : Page , base_expected_db
371368) -> None :
372369 """
373370 Scenario: Subject is at status Surveillance, cease for No Colon, programme assessed
@@ -440,20 +437,15 @@ def test_manual_cease_from_surveillance_subject_for_no_colon_programme_assessed(
440437 expect (summary_table ).to_contain_text (today )
441438
442439 expected_db = {
440+ ** base_expected_db ,
443441 "Screening Status" : ScreeningStatus .CEASED ,
444442 "Screening Status Reason" : ScreeningStatusReason .NO_COLON_PROGRAMME_ASSESSED ,
445443 "Screening Status Date of Change" : EXPECT .TODAY ,
446- "Screening Due Date Reason" : ScreeningDueDateReason .CEASED ,
447444 "Screening Due Date" : EXPECT .NULL ,
445+ "Screening Due Date Reason" : ScreeningDueDateReason .CEASED ,
448446 "Screening due date date of change" : EXPECT .UNCHANGED ,
449447 "Ceased Confirmation Details" : "AUTO TEST: notes" ,
450448 "Clinical Reason for Cease" : EXPECT .NULL ,
451- "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
452- "Calculated Lynch Due Date" : EXPECT .NULL ,
453- "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
454- "Lynch due date" : EXPECT .NULL ,
455- "Lynch due date reason" : EXPECT .UNCHANGED ,
456- "Lynch due date date of change" : EXPECT .UNCHANGED ,
457449 "Surveillance due date" : EXPECT .NULL ,
458450 "Surveillance due date reason" : SurveillanceDueDateReason .CEASED ,
459451 "Surveillance due date date of change" : EXPECT .TODAY ,
@@ -469,7 +461,7 @@ def test_manual_cease_from_surveillance_subject_for_no_colon_programme_assessed(
469461@pytest .mark .manual_cease
470462@pytest .mark .regression
471463def test_manual_cease_from_already_ceased_subject_for_informal_death (
472- page : Page ,
464+ page : Page , base_expected_db
473465) -> None :
474466 """
475467 Scenario: Subject is at status Ceased, outside screening population, cease for Informal Death
@@ -545,18 +537,13 @@ def test_manual_cease_from_already_ceased_subject_for_informal_death(
545537 expect (summary_table ).to_contain_text (today )
546538
547539 expected_db = {
548- "Screening Status" : ScreeningStatus . CEASED ,
540+ ** base_expected_db ,
549541 "Screening Status Reason" : ScreeningStatusReason .INFORMAL_DEATH ,
550542 "Screening Status Date of Change" : EXPECT .UNCHANGED ,
551- "Screening Due Date" : EXPECT .NULL ,
552543 "Screening Due Date Reason" : EXPECT .UNCHANGED ,
553544 "Screening due date date of change" : EXPECT .UNCHANGED ,
554- "Ceased Confirmation Details" : "AUTO TEST: notes" ,
555545 "Ceased Confirmation Date" : EXPECT .TODAY ,
556- "Clinical Reason for Cease" : EXPECT .NULL ,
557- "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
558546 "Calculated Lynch Due Date" : EXPECT .NULL ,
559- "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
560547 "Lynch due date" : EXPECT .NULL ,
561548 "Lynch due date reason" : EXPECT .UNCHANGED ,
562549 "Lynch due date date of change" : EXPECT .UNCHANGED ,
@@ -571,11 +558,12 @@ def test_manual_cease_from_already_ceased_subject_for_informal_death(
571558 )
572559
573560
561+ @pytest .mark .wip
574562@pytest .mark .vpn_required
575563@pytest .mark .manual_cease
576564@pytest .mark .regression
577565def test_manual_cease_from_already_ceased_subject_for_no_colon_subject_request (
578- page : Page ,
566+ page : Page , base_expected_db
579567) -> None :
580568 """
581569 Scenario: Subject is at status Ceased, outside screening population, cease for No Colon (subject request)
@@ -654,18 +642,13 @@ def test_manual_cease_from_already_ceased_subject_for_no_colon_subject_request(
654642
655643 # Define expected database values post-cease
656644 expected_db = {
657- "Screening Status" : ScreeningStatus . CEASED ,
645+ ** base_expected_db ,
658646 "Screening Status Reason" : ScreeningStatusReason .NO_COLON_SUBJECT_REQUEST ,
659647 "Screening Status Date of Change" : EXPECT .UNCHANGED ,
660- "Screening Due Date" : EXPECT .NULL ,
661648 "Screening Due Date Reason" : EXPECT .UNCHANGED ,
662649 "Screening due date date of change" : EXPECT .UNCHANGED ,
663- "Ceased Confirmation Details" : "AUTO TEST: notes" ,
664650 "Ceased Confirmation Date" : EXPECT .TODAY ,
665- "Clinical Reason for Cease" : EXPECT .NULL ,
666- "Calculated FOBT Due Date" : EXPECT .UNCHANGED ,
667651 "Calculated Lynch Due Date" : EXPECT .NULL ,
668- "Calculated Surveillance Due Date" : EXPECT .UNCHANGED ,
669652 "Lynch due date" : EXPECT .NULL ,
670653 "Lynch due date reason" : EXPECT .UNCHANGED ,
671654 "Lynch due date date of change" : EXPECT .UNCHANGED ,
0 commit comments