Skip to content

Commit 97db903

Browse files
Merge pull request #513 from NHSDigital/mav-691
Mav 691
2 parents 641e0d8 + 4971846 commit 97db903

File tree

7 files changed

+74
-8
lines changed

7 files changed

+74
-8
lines changed

mavis/test/data/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pandas as pd
99
from faker import Faker
1010

11-
from mavis.test.models import Child, Organisation, Programme, School, User
11+
from mavis.test.models import Child, Clinic, Organisation, Programme, School, Team, User
1212
from mavis.test.wrappers import (
1313
get_current_datetime,
1414
get_current_time,
@@ -52,6 +52,7 @@ class VaccsFileMapping(FileMapping):
5252
SYSTMONE_WHITESPACE = "systmone_whitespace"
5353
HIST_FLU_NIVS = "hist_flu_nivs"
5454
HIST_FLU_SYSTMONE = "hist_flu_systmone"
55+
CLINIC_NAME_CASE = "clinic_name_case"
5556

5657
@property
5758
def folder(self) -> Path:
@@ -108,17 +109,21 @@ class TestData:
108109

109110
def __init__(
110111
self,
112+
team: Team,
111113
organisation: Organisation,
112114
schools: dict[str, list[School]],
113115
nurse: User,
114116
children: dict[str, list[Child]],
117+
clinics: list[Clinic],
115118
year_groups: dict[str, str],
116119
):
117120
self.organisation = organisation
118121
self.schools = schools
119122
self.nurse = nurse
120123
self.children = children
124+
self.clinics = clinics
121125
self.year_groups = year_groups
126+
self.team = team
122127

123128
self.faker = Faker(locale="en_GB")
124129

@@ -160,6 +165,12 @@ def create_file_from_template(
160165
if self.nurse:
161166
static_replacements["<<NURSE_EMAIL>>"] = self.nurse.username
162167

168+
if self.clinics:
169+
clinics = self.clinics
170+
for index, clinic in enumerate(clinics):
171+
static_replacements[f"<<CLINIC_{index}_LOWER>>"] = clinic.name.lower()
172+
static_replacements[f"<<CLINIC_{index}>>"] = clinic.name
173+
163174
if self.children:
164175
children = self.children[programme_group]
165176
for index, child in enumerate(children):
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
TEST_DESC_IGNORED,ORGANISATION_CODE,SCHOOL_URN,SCHOOL_NAME,NHS_NUMBER,PERSON_FORENAME,PERSON_SURNAME,PERSON_DOB,PERSON_GENDER_CODE,PERSON_POSTCODE,DATE_OF_VACCINATION,VACCINE_GIVEN,BATCH_NUMBER,BATCH_EXPIRY_DATE,ANATOMICAL_SITE,DOSE_SEQUENCE,VACCINATED,CARE_SETTING,PERFORMING_PROFESSIONAL_FORENAME,PERFORMING_PROFESSIONAL_SURNAME,PERFORMING_PROFESSIONAL_EMAIL,CLINIC_NAME,TIME_OF_VACCINATION,REASON_NOT_VACCINATED,SESSION_ID,PROGRAMME
2+
IncorrectSpelling,<<ORG_CODE>>,<<SCHOOL_0_URN>>,<<SCHOOL_0_NAME>>,<<RANDOM_NHS_NO>>,<<RANDOM_FNAME>>,<<RANDOM_LNAME>>,20100812,Male,DN9 1PB,<<VACCS_DATE>>,Gardasil9,AutoBatch1,20320730,right arm (lower position),1,Y,2,,,<<NURSE_EMAIL>>,Royal Arsenal Med Centre,00:01,,<<SESSION_ID>>,HPV
3+
IncorrectCase,<<ORG_CODE>>,<<SCHOOL_0_URN>>,<<SCHOOL_0_NAME>>,<<RANDOM_NHS_NO>>,<<RANDOM_FNAME>>,<<RANDOM_LNAME>>,20100811,Male,DN9 1PB,<<VACCS_DATE>>,Gardasil9,AutoBatch1,20320730,right arm (lower position),1,Y,2,,,<<NURSE_EMAIL>>,<<CLINIC_0_LOWER>>,00:01,,<<SESSION_ID>>,HPV
4+
CorrectCase,<<ORG_CODE>>,<<SCHOOL_0_URN>>,<<SCHOOL_0_NAME>>,<<RANDOM_NHS_NO>>,<<RANDOM_FNAME>>,<<RANDOM_LNAME>>,20100813,Male,DN9 1PB,<<VACCS_DATE>>,Gardasil9,AutoBatch1,20320730,right arm (lower position),1,Y,2,,,<<NURSE_EMAIL>>,<<CLINIC_0>>,00:01,,<<SESSION_ID>>,HPV
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Row 2 CLINIC_NAME: is not recognised
2+
!Row 3
3+
!Row 4

mavis/test/fixtures/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import os
12
from datetime import date, timedelta
23

34
import pytest
4-
import os
55

66
from mavis.test.data import TestData
77
from mavis.test.models import Vaccine
@@ -102,8 +102,8 @@ def log_in_as_nurse(set_feature_flags, nurse, team, log_in_page):
102102

103103

104104
@pytest.fixture
105-
def test_data(organisation, schools, nurse, children, year_groups):
106-
return TestData(organisation, schools, nurse, children, year_groups)
105+
def test_data(team, organisation, schools, nurse, children, clinics, year_groups):
106+
return TestData(team, organisation, schools, nurse, children, clinics, year_groups)
107107

108108

109109
@pytest.fixture

mavis/test/fixtures/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
from mavis.test.models import (
1717
Child,
1818
Clinic,
19-
Team,
19+
Organisation,
2020
Parent,
21+
Programme,
2122
Relationship,
2223
School,
2324
Subteam,
25+
Team,
2426
User,
25-
Programme,
26-
Organisation,
2727
)
2828
from mavis.test.wrappers import get_date_of_birth_for_year_group, normalize_whitespace
2929

tests/test_import_records.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,44 @@ def setup_vaccs(
6565
sessions_page.delete_all_sessions(school)
6666

6767

68+
@pytest.fixture
69+
def setup_vaccs_clinic(
70+
log_in_as_nurse,
71+
schools,
72+
dashboard_page,
73+
sessions_page,
74+
import_records_page,
75+
):
76+
school = schools[Programme.HPV][0]
77+
try:
78+
dashboard_page.click_sessions()
79+
sessions_page.schedule_a_valid_session(
80+
"Community clinic", Programme.HPV, for_today=True
81+
)
82+
dashboard_page.click_mavis()
83+
dashboard_page.click_sessions()
84+
sessions_page.schedule_a_valid_session(school, Programme.HPV, for_today=True)
85+
sessions_page.click_import_class_lists()
86+
sessions_page.select_year_groups_for_programme(Programme.HPV)
87+
import_records_page.upload_and_verify_output(
88+
ClassFileMapping.RANDOM_CHILD_YEAR_9
89+
)
90+
dashboard_page.click_mavis()
91+
dashboard_page.click_sessions()
92+
sessions_page.click_session_for_programme_group(
93+
"Community clinic", Programme.HPV
94+
)
95+
session_id = sessions_page.get_session_id_from_offline_excel()
96+
dashboard_page.click_mavis()
97+
dashboard_page.click_import_records()
98+
import_records_page.navigate_to_vaccination_records_import()
99+
yield session_id
100+
finally:
101+
dashboard_page.click_mavis()
102+
dashboard_page.click_sessions()
103+
sessions_page.delete_all_sessions("Community clinic")
104+
105+
68106
@pytest.fixture
69107
def setup_vaccs_systmone(
70108
log_in_as_nurse,
@@ -365,3 +403,13 @@ def test_vaccs_systmone_disallow_flu_for_previous_years(
365403
import_records_page.upload_and_verify_output(
366404
VaccsFileMapping.HIST_FLU_SYSTMONE, session_id=setup_vaccs_systmone
367405
)
406+
407+
408+
@issue("MAV-691")
409+
@pytest.mark.vaccinations
410+
@pytest.mark.bug
411+
def test_vaccs_community_clinic_name_case(setup_vaccs_clinic, import_records_page):
412+
import_records_page.upload_and_verify_output(
413+
VaccsFileMapping.CLINIC_NAME_CASE,
414+
session_id=setup_vaccs_clinic,
415+
)

utils/001_cleanup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22

33
# This script is designed to be run manually to clear down the 'working', 'reports' and 'screenshots' directories.
4-
folders_to_clean = ["working"] # "reports"
4+
folders_to_clean = ["working", "allure-results"] # "reports"
55

66

77
def cleanup() -> None:

0 commit comments

Comments
 (0)