Skip to content

Commit e4cc8d4

Browse files
committed
Remove massive file
1 parent 82856cd commit e4cc8d4

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

backend/src/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ class Urls:
2424

2525
GENERIC_SERVER_ERROR_DIAGNOSTICS_MESSAGE = "Unable to process request. Issue may be transient."
2626
SUPPLIER_PERMISSIONS_HASH_KEY = "supplier_permissions"
27+
# Maximum response size for an AWS Lambda function
28+
MAX_RESPONSE_SIZE_BYTES = 6 * 1024 * 1024

backend/src/search_imms_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from fhir_controller import FhirController, make_controller
1111
from models.errors import Severity, Code, create_operation_outcome
12-
from constants import GENERIC_SERVER_ERROR_DIAGNOSTICS_MESSAGE
12+
from constants import GENERIC_SERVER_ERROR_DIAGNOSTICS_MESSAGE, MAX_RESPONSE_SIZE_BYTES
1313
from log_structure import function_info
1414
import base64
1515
import urllib.parse
@@ -57,7 +57,7 @@ def search_imms(event: events.APIGatewayProxyEventV1, controller: FhirController
5757
result_json = json.dumps(response)
5858
result_size = len(result_json.encode("utf-8"))
5959

60-
if result_size > 6 * 1024 * 1024:
60+
if result_size > MAX_RESPONSE_SIZE_BYTES:
6161
exp_error = create_operation_outcome(
6262
resource_id=str(uuid.uuid4()),
6363
severity=Severity.error,

backend/tests/sample_data/sample_input_search_imms.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

backend/tests/test_search_imms.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,12 @@ def test_search_immunizations_get_id_from_body_imms_identifer(self):
127127
self.controller.get_immunization_by_identifier.assert_called_once_with(lambda_event)
128128
self.assertDictEqual(exp_res, act_res)
129129

130+
@patch("search_imms_handler.MAX_RESPONSE_SIZE_BYTES", 10)
130131
def test_search_immunizations_lambda_size_limit(self):
131132
"""it should return 400 as search returned too many results."""
132133
lambda_event = {"pathParameters": {"id": "an-id"}, "body": None}
133-
request_file = script_location / "sample_data" / "sample_input_search_imms.json"
134-
with open(request_file) as f:
135-
exp_res = json.load(f)
136-
self.controller.search_immunizations.return_value = json.dumps(exp_res)
137134

138-
self.controller.search_immunizations.return_value = exp_res
135+
self.controller.search_immunizations.return_value = {"response": "size is larger than lambda limit"}
139136

140137
# When
141138
act_res = search_imms(lambda_event, self.controller)

0 commit comments

Comments
 (0)