Skip to content

Commit c6717db

Browse files
committed
fix tallying tests
1 parent d34dbed commit c6717db

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

tests/test_tallying.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@
3030

3131

3232
@pytest.fixture
33-
def setup_tests(log_in_as_nurse, page):
34-
DashboardPage(page).click_sessions()
35-
36-
37-
@pytest.fixture
38-
def setup_session_with_file_upload(
33+
def setup_flu_vaccination(
3934
setup_tests,
4035
add_vaccine_batch,
4136
schools,
@@ -47,6 +42,7 @@ def setup_session_with_file_upload(
4742
year_group = year_groups[Programme.FLU]
4843

4944
def _setup(class_list_file):
45+
DashboardPage(page).click_sessions()
5046
batch_names = {
5147
vaccine: add_vaccine_batch(vaccine)
5248
for vaccine in [Vaccine.SEQUIRUS, Vaccine.FLUENZ]
@@ -65,8 +61,8 @@ def _setup(class_list_file):
6561

6662

6763
@pytest.fixture
68-
def setup_fixed_child(setup_session_with_file_upload):
69-
yield from setup_session_with_file_upload(ClassFileMapping.FIXED_CHILD)
64+
def setup_fixed_child(setup_flu_vaccination):
65+
yield from setup_flu_vaccination(ClassFileMapping.FIXED_CHILD)
7066

7167

7268
@issue("MAV-1669")
@@ -170,9 +166,12 @@ def test_tallying( # noqa: PLR0915
170166
"programme", list(Programme), ids=lambda p: f"Programme: {p.value}"
171167
)
172168
def test_tallying_totals_match_eligible_patients(
173-
setup_fixed_child,
169+
log_in_as_nurse,
174170
page,
175171
programme,
172+
year_groups,
173+
schools,
174+
file_generator,
176175
):
177176
"""
178177
Test: Verify that tallying totals match the number of eligible patients.
@@ -183,6 +182,17 @@ def test_tallying_totals_match_eligible_patients(
183182
- Sum of tally totals should equal the number of eligible children shown
184183
on the children tab.
185184
"""
185+
school = schools[programme][0]
186+
year_group = year_groups[programme]
187+
188+
DashboardPage(page).click_schools()
189+
SchoolsSearchPage(page).click_school(school)
190+
SchoolsChildrenPage(page).click_import_class_lists()
191+
ImportRecordsWizardPage(page, file_generator).import_class_list(
192+
ClassFileMapping.FIXED_CHILD, year_group, programme.group
193+
)
194+
schedule_school_session_if_needed(page, school, [programme], [year_group])
195+
186196
# Get tally totals for the programme
187197
tally_totals = SessionsOverviewPage(page).get_all_totals(programme)
188198
sum_of_tally_totals = sum(tally_totals.values())

0 commit comments

Comments
 (0)