File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 66from copy import deepcopy
77from pydantic import ValidationError
88from jsonpath_ng .ext import parse
9+ from sample_data .mock_redis_cache import fake_hget
910
1011
1112from src .models .fhir_immunization import ImmunizationValidator
@@ -41,6 +42,7 @@ def setUp(self):
4142 ]
4243 self .redis_patcher = patch ("models.utils.validation_utils.redis_client" )
4344 self .mock_redis_client = self .redis_patcher .start ()
45+ self .mock_redis_client .hget .side_effect = fake_hget
4446
4547 def test_collected_errors (self ):
4648 """Test that when passed multiple validation errors, it returns a list of all expected errors"""
Original file line number Diff line number Diff line change 11import json
22import unittest
3- from unittest .mock import create_autospec
3+ from unittest .mock import create_autospec , patch
44
55from fhir_controller import FhirController
66from models .errors import Severity , Code , create_operation_outcome
1414class TestSearchImmunizations (unittest .TestCase ):
1515 def setUp (self ):
1616 self .controller = create_autospec (FhirController )
17+ self .logger_exception_patcher = patch ("logging.Logger.exception" )
18+ self .mock_logger_exception = self .logger_exception_patcher .start ()
19+
20+ def tearDown (self ):
21+ patch .stopall ()
1722
1823 def test_search_immunizations (self ):
1924 """it should return a list of Immunizations"""
@@ -153,7 +158,7 @@ def test_handle_exception(self):
153158
154159 # Then
155160 act_body = json .loads (act_res ["body" ])
156- act_body ["id" ] = None
161+ # act_body["id"] = None
157162
158163 self .assertEqual (exp_error ["issue" ][0 ]["code" ], act_body ["issue" ][0 ]["code" ])
159164 self .assertEqual (exp_error ["issue" ][0 ]["severity" ], act_body ["issue" ][0 ]["severity" ])
You can’t perform that action at this time.
0 commit comments