Skip to content

Commit 4050fdf

Browse files
committed
rename test_data fixture
1 parent 1e6e782 commit 4050fdf

20 files changed

+162
-144
lines changed

mavis/test/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
children,
1010
clinics,
1111
delete_team_after_tests,
12+
file_generator,
1213
healthcare_assistant,
1314
imms_base_url,
1415
log_in_as_medical_secretary,
@@ -29,7 +30,6 @@
2930
subteam,
3031
superuser,
3132
team,
32-
test_data,
3333
upload_offline_vaccination,
3434
year_groups,
3535
)
@@ -46,6 +46,7 @@
4646
"children",
4747
"clinics",
4848
"delete_team_after_tests",
49+
"file_generator",
4950
"healthcare_assistant",
5051
"imms_base_url",
5152
"log_in_as_medical_secretary",
@@ -69,7 +70,6 @@
6970
"subteam",
7071
"superuser",
7172
"team",
72-
"test_data",
7373
"upload_offline_vaccination",
7474
"year_groups",
7575
]

mavis/test/fixtures/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from .helpers import (
22
add_vaccine_batch,
3+
file_generator,
34
log_in_as_medical_secretary,
45
log_in_as_nurse,
56
log_in_as_prescriber,
67
schedule_mmr_session_and_get_consent_url,
78
schedule_session_and_get_consent_url,
89
set_feature_flags,
910
setup_session_and_batches_with_fixed_child,
10-
test_data,
1111
upload_offline_vaccination,
1212
)
1313
from .models import (
@@ -49,6 +49,7 @@
4949
"children",
5050
"clinics",
5151
"delete_team_after_tests",
52+
"file_generator",
5253
"healthcare_assistant",
5354
"imms_base_url",
5455
"log_in_as_medical_secretary",
@@ -69,7 +70,6 @@
6970
"subteam",
7071
"superuser",
7172
"team",
72-
"test_data",
7373
"upload_offline_vaccination",
7474
"year_groups",
7575
]

mavis/test/fixtures/helpers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def upload_offline_vaccination(
142142
schools,
143143
page,
144144
children,
145-
test_data,
145+
file_generator,
146146
):
147147
def wrapper(
148148
programme: Programme, consent_option: ConsentOption = ConsentOption.INJECTION
@@ -168,7 +168,7 @@ def wrapper(
168168
DashboardPage(page).click_schools()
169169
SchoolsSearchPage(page).click_school(school)
170170
SchoolsChildrenPage(page).click_import_class_lists()
171-
ImportRecordsWizardPage(page, test_data).import_class_list(
171+
ImportRecordsWizardPage(page, file_generator).import_class_list(
172172
ClassFileMapping.FIXED_CHILD,
173173
child.year_group,
174174
programme.group,
@@ -186,9 +186,9 @@ def wrapper(
186186
DashboardPage(page).click_imports()
187187
ImportsPage(page).click_upload_records()
188188
ImportRecordsWizardPage(
189-
page, test_data
189+
page, file_generator
190190
).navigate_to_vaccination_records_import()
191-
ImportRecordsWizardPage(page, test_data).upload_and_verify_output(
191+
ImportRecordsWizardPage(page, file_generator).upload_and_verify_output(
192192
file_mapping=vaccs_file,
193193
session_id=session_id,
194194
programme_group=programme.group,
@@ -211,7 +211,7 @@ def setup_session_and_batches_with_fixed_child(
211211
schools,
212212
children,
213213
page,
214-
test_data,
214+
file_generator,
215215
nurse,
216216
team,
217217
):
@@ -231,7 +231,7 @@ def _setup(programme_group):
231231
DashboardPage(page).click_schools()
232232
SchoolsSearchPage(page).click_school(school)
233233
SchoolsChildrenPage(page).click_import_class_lists()
234-
ImportRecordsWizardPage(page, test_data).import_class_list(
234+
ImportRecordsWizardPage(page, file_generator).import_class_list(
235235
ClassFileMapping.FIXED_CHILD,
236236
child.year_group,
237237
programme_group,
@@ -245,5 +245,5 @@ def _setup(programme_group):
245245

246246

247247
@pytest.fixture
248-
def test_data(organisation, schools, nurse, children, clinics, year_groups):
248+
def file_generator(organisation, schools, nurse, children, clinics, year_groups):
249249
return FileGenerator(organisation, schools, nurse, children, clinics, year_groups)

mavis/test/pages/imports/import_records_wizard_page.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class ImportRecordsWizardPage:
1919
def __init__(
2020
self,
2121
page: Page,
22-
test_data: FileGenerator,
22+
file_generator: FileGenerator,
2323
) -> None:
2424
self.page = page
25-
self.test_data = test_data
25+
self.file_generator = file_generator
2626
self.header = HeaderComponent(page)
2727

2828
self.alert_success = self.page.get_by_text("Import processing started")
@@ -170,7 +170,7 @@ def upload_and_verify_output(
170170
session_id: str | None = None,
171171
programme_group: str = Programme.HPV.group,
172172
) -> tuple[Path, Path]:
173-
_input_file_path, _output_file_path = self.test_data.get_file_paths(
173+
_input_file_path, _output_file_path = self.file_generator.get_file_paths(
174174
file_mapping=file_mapping,
175175
session_id=session_id,
176176
programme_group=programme_group,
@@ -222,7 +222,7 @@ def click_uploaded_file_datetime(self, date_time: datetime) -> None:
222222

223223
@step("Verify upload output for {file_path}")
224224
def verify_upload_output(self, file_path: Path) -> None:
225-
_expected_errors = self.test_data.get_expected_errors(file_path)
225+
_expected_errors = self.file_generator.get_expected_errors(file_path)
226226
if _expected_errors is not None:
227227
for _msg in _expected_errors:
228228
if _msg.startswith("!"):

tests/test_children.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
def setup_children_session(
3333
log_in_as_nurse,
3434
page,
35-
test_data,
35+
file_generator,
3636
schools,
3737
year_groups,
3838
):
@@ -43,7 +43,7 @@ def _setup(class_list_file):
4343
DashboardPage(page).click_schools()
4444
SchoolsSearchPage(page).click_school(school)
4545
SchoolsChildrenPage(page).click_import_class_lists()
46-
ImportRecordsWizardPage(page, test_data).import_class_list(
46+
ImportRecordsWizardPage(page, file_generator).import_class_list(
4747
class_list_file, year_group
4848
)
4949
ImportsPage(page).header.click_mavis_header()
@@ -78,7 +78,7 @@ def setup_mav_853(
7878
log_in_as_nurse,
7979
schools,
8080
page,
81-
test_data,
81+
file_generator,
8282
year_groups,
8383
):
8484
school = schools[Programme.HPV][0]
@@ -87,7 +87,7 @@ def setup_mav_853(
8787
DashboardPage(page).click_schools()
8888
SchoolsSearchPage(page).click_school(school)
8989
SchoolsChildrenPage(page).click_import_class_lists()
90-
ImportRecordsWizardPage(page, test_data).import_class_list(
90+
ImportRecordsWizardPage(page, file_generator).import_class_list(
9191
ClassFileMapping.RANDOM_CHILD, year_group
9292
)
9393
ImportsPage(page).header.click_mavis_header()
@@ -107,15 +107,17 @@ def setup_mav_853(
107107
ProgrammesListPage(page).click_programme_for_current_year(Programme.HPV)
108108
ProgrammeOverviewPage(page).tabs.click_children_tab()
109109
ProgrammeChildrenPage(page).click_import_child_records()
110-
ImportRecordsWizardPage(page, test_data).import_class_list(
110+
ImportRecordsWizardPage(page, file_generator).import_class_list(
111111
CohortsFileMapping.FIXED_CHILD
112112
)
113113

114114
ImportsPage(page).header.click_mavis_header()
115115
DashboardPage(page).click_imports()
116116
ImportsPage(page).click_upload_records()
117-
ImportRecordsWizardPage(page, test_data).navigate_to_vaccination_records_import()
118-
ImportRecordsWizardPage(page, test_data).upload_and_verify_output(
117+
ImportRecordsWizardPage(
118+
page, file_generator
119+
).navigate_to_vaccination_records_import()
120+
ImportRecordsWizardPage(page, file_generator).upload_and_verify_output(
119121
file_mapping=VaccsFileMapping.NOT_GIVEN,
120122
session_id=session_id,
121123
)

tests/test_consent_responses.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_match_unmatched_consent_response_and_verify_activity_log(
117117
log_in_as_nurse,
118118
children,
119119
page,
120-
test_data,
120+
file_generator,
121121
):
122122
"""
123123
Test: Match an unmatched consent response to a child and verify activity log.
@@ -138,7 +138,7 @@ def test_match_unmatched_consent_response_and_verify_activity_log(
138138
ProgrammesListPage(page).click_programme_for_current_year(Programme.HPV)
139139
ProgrammeOverviewPage(page).tabs.click_children_tab()
140140
ProgrammeChildrenPage(page).click_import_child_records()
141-
ImportRecordsWizardPage(page, test_data).import_class_list(
141+
ImportRecordsWizardPage(page, file_generator).import_class_list(
142142
CohortsFileMapping.FIXED_CHILD
143143
)
144144
ImportsPage(page).header.click_mavis_header()
@@ -238,7 +238,7 @@ def test_accessibility(
238238
log_in_as_nurse,
239239
children,
240240
page,
241-
test_data,
241+
file_generator,
242242
):
243243
"""
244244
Test: Check accessibility of consent response pages.
@@ -254,7 +254,7 @@ def test_accessibility(
254254
ProgrammesListPage(page).click_programme_for_current_year(Programme.HPV)
255255
ProgrammeOverviewPage(page).tabs.click_children_tab()
256256
ProgrammeChildrenPage(page).click_import_child_records()
257-
ImportRecordsWizardPage(page, test_data).import_class_list(
257+
ImportRecordsWizardPage(page, file_generator).import_class_list(
258258
CohortsFileMapping.FIXED_CHILD
259259
)
260260
ImportsPage(page).header.click_mavis_header()
@@ -278,7 +278,7 @@ def test_match_consent_with_vaccination_record_no_service_error(
278278
upload_offline_vaccination,
279279
children,
280280
page,
281-
test_data,
281+
file_generator,
282282
):
283283
"""
284284
Test: Submit a consent form that won't match automatically, find a patient
@@ -305,7 +305,7 @@ def test_match_consent_with_vaccination_record_no_service_error(
305305
ProgrammesListPage(page).click_programme_for_current_year(Programme.HPV)
306306
ProgrammeOverviewPage(page).tabs.click_children_tab()
307307
ProgrammeChildrenPage(page).click_import_child_records()
308-
ImportRecordsWizardPage(page, test_data).import_class_list(
308+
ImportRecordsWizardPage(page, file_generator).import_class_list(
309309
ClassFileMapping.TWO_FIXED_CHILDREN
310310
)
311311

0 commit comments

Comments
 (0)