Skip to content

Commit e48863d

Browse files
committed
remock & tidy
1 parent 022f527 commit e48863d

File tree

5 files changed

+3
-9
lines changed

5 files changed

+3
-9
lines changed

backend/tests/test_fhir_controller.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from tests.utils.immunization_utils import create_covid_19_immunization
3030
from parameter_parser import patient_identifier_system, process_search_params, SearchParams
3131
from tests.utils.generic_utils import load_json_data
32-
from utils.mock_redis import mock_redis_hkeys
3332

3433

3534
class TestFhirControllerBase(unittest.TestCase):

backend/tests/test_fhir_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
)
2424
from utils.generic_utils import load_json_data
2525
from constants import NHS_NUMBER_USED_IN_SAMPLE_DATA
26-
from utils.mock_redis import mock_redis_hget
2726

2827
class TestFhirServiceBase(unittest.TestCase):
2928
"""Base class for all tests to set up common fixtures"""
@@ -32,7 +31,6 @@ def setUp(self):
3231
super().setUp()
3332
self.redis_patcher = patch("models.utils.validation_utils.redis_client")
3433
self.mock_redis_client = self.redis_patcher.start()
35-
self.mock_redis_client.hget.side_effect = mock_redis_hget
3634
self.logger_info_patcher = patch("logging.Logger.info")
3735
self.mock_logger_info = self.logger_info_patcher.start()
3836

@@ -140,6 +138,7 @@ def test_pre_validation_failed(self):
140138
self.imms_repo.update_immunization.assert_not_called()
141139

142140
def test_post_validation_failed_get_by_all(self):
141+
self.mock_redis_client.hget.side_effect = [None, 'COVID-19']
143142
valid_imms = create_covid_19_immunization_dict("an-id", VALID_NHS_NUMBER)
144143

145144
bad_target_disease_imms = deepcopy(valid_imms)
@@ -260,6 +259,7 @@ def test_pre_validation_failed(self):
260259
self.pds_service.get_patient_details.assert_not_called()
261260

262261
def test_post_validation_failed_get(self):
262+
self.mock_redis_client.hget.side_effect = [None, 'COVID-19']
263263
valid_imms = create_covid_19_immunization_dict("an-id", VALID_NHS_NUMBER)
264264

265265
bad_target_disease_imms = deepcopy(valid_imms)
@@ -412,7 +412,7 @@ def test_pre_validation_failed(self):
412412

413413
def test_post_validation_failed_create(self):
414414
"""it should throw exception if Immunization is not valid"""
415-
415+
self.mock_redis_client.hget.side_effect = [None, 'COVID-19']
416416
valid_imms = create_covid_19_immunization_dict_no_id(VALID_NHS_NUMBER)
417417

418418
bad_target_disease_imms = deepcopy(valid_imms)

backend/tests/test_immunization_post_validator.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
from tests.utils.mandation_test_utils import MandationTests
1818
from tests.utils.values_for_tests import NameInstances
1919
from tests.utils.generic_utils import update_contained_resource_field
20-
# import redis mock functions
21-
from utils.mock_redis import mock_redis_hget, mock_redis_hkeys
2220

2321
class TestImmunizationModelPostValidationRules(unittest.TestCase):
2422
"""Test immunization post validation rules on the FHIR model"""
@@ -99,7 +97,6 @@ def test_post_validate_and_set_vaccine_type(self):
9997
"protocolApplied[0].targetDisease[0].coding[?(@.system=='http://snomed.info/sct')].code"
10098
)
10199

102-
# self.mock_redis_client.hget.side_effect = mock_redis_hget
103100
self.mock_redis_client.hget.side_effect = [ "COVID19", "FLU",
104101
"HPV",
105102
"MMR",

backend/tests/test_parameter_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
create_query_string,
1515
SearchParams,
1616
)
17-
from utils.mock_redis import mock_redis_hkeys
1817

1918
class TestParameterParser(unittest.TestCase):
2019
def setUp(self):

backend/tests/test_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import json
55
from unittest.mock import patch, MagicMock
66
from copy import deepcopy
7-
from utils.mock_redis import mock_redis_hget
87

98
from models.utils.validation_utils import convert_disease_codes_to_vaccine_type, get_vaccine_type
109
from utils.generic_utils import load_json_data, update_target_disease_code

0 commit comments

Comments
 (0)