Skip to content

Commit 94955b6

Browse files
committed
WIP Delete Remove issues
1 parent 138afed commit 94955b6

File tree

5 files changed

+38
-162
lines changed

5 files changed

+38
-162
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This class is copied from the e2e project
2+
# @TODO: replace with a solution for shared code
3+
class EndpointOperationNames:
4+
"""String enums for the name of each endpoint operation"""
5+
6+
CREATE = "CREATE"
7+
READ = "READ"
8+
UPDATE = "UPDATE"
9+
DELETE = "DELETE"
10+
SEARCH = "SEARCH"
11+
12+
13+
class VaccineTypes:
14+
"""Vaccine types"""
15+
16+
covid_19: str = "COVID19"
17+
flu: str = "FLU"
18+
hpv: str = "HPV"
19+
mmr: str = "MMR"
20+
rsv: str = "RSV"
21+
22+
23+
vaccine_type_mappings = [
24+
(["840539006"], VaccineTypes.covid_19),
25+
(["6142004"], VaccineTypes.flu),
26+
(["240532009"], VaccineTypes.hpv),
27+
(["14189004", "36653000", "36989005"], VaccineTypes.mmr),
28+
(["55735004"], VaccineTypes.rsv),
29+
]

delta_backend/tests/helpers/test_delta_table.py

Lines changed: 0 additions & 155 deletions
This file was deleted.

delta_backend/tests/test_convert_to_flat_json.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from Converter import Converter
1818
from ConversionChecker import ConversionChecker, RecordError
1919
import ExceptionMessages
20+
from helpers.mappings import EndpointOperationNames
2021

2122
MOCK_ENV_VARS = {
2223
"AWS_SQS_QUEUE_URL": "https://sqs.eu-west-2.amazonaws.com/123456789012/test-queue",
@@ -181,9 +182,9 @@ def test_fhir_converter_json_error_scenario(self):
181182
def test_handler_imms_convert_to_flat_json(self):
182183
"""Test that the Imms field contains the correct flat JSON data for CREATE, UPDATE, and DELETE operations."""
183184
expected_action_flags = [
184-
# {"Operation": "CREATE", "EXPECTED_ACTION_FLAG": "NEW"},
185-
# {"Operation": "UPDATE", "EXPECTED_ACTION_FLAG": "UPDATE"},
186-
{"Operation": "DELETE", "EXPECTED_ACTION_FLAG": "DELETE"},
185+
# {"Operation": EndpointOperationNames.CREATE, "EXPECTED_ACTION_FLAG": "NEW"},
186+
# {"Operation": EndpointOperationNames.UPDATE, "EXPECTED_ACTION_FLAG": "UPDATE"},
187+
{"Operation": EndpointOperationNames.DELETE, "EXPECTED_ACTION_FLAG": "DELETE"},
187188
]
188189

189190
for test_case in expected_action_flags:

delta_backend/tests/test_delta.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from botocore.exceptions import ClientError
44
import os
55
import json
6+
from helpers.mappings import EndpointOperationNames
67

78
# Set environment variables before importing the module
89
## @TODO: # Note: Environment variables shared across tests, thus aligned
@@ -64,7 +65,7 @@ def get_event(event_name="INSERT", operation="CREATE", supplier="EMIS", n_record
6465

6566
@staticmethod
6667
def get_event_record(pk, event_name="INSERT", operation="CREATE", supplier="EMIS"):
67-
if operation != "DELETE":
68+
if operation != EndpointOperationNames.DELETE:
6869
return{
6970
"eventName": event_name,
7071
"dynamodb": {
@@ -183,7 +184,7 @@ def test_handler_success_update(self, mock_boto_resource, mock_write_to_db):
183184
def test_handler_success_remove(self, mock_boto_resource):
184185
# Arrange
185186
self.setup_mock_dynamodb(mock_boto_resource)
186-
event = self.get_event(event_name="REMOVE", operation="DELETE")
187+
event = self.get_event(event_name="REMOVE", operation=EndpointOperationNames.DELETE)
187188

188189
# Act
189190
result = handler(event, self.context)

delta_backend/tests/utils_for_converter_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from decimal import Decimal
22
import json
3-
3+
from helpers.mappings import EndpointOperationNames
44

55
class ValuesForTests:
66

@@ -119,7 +119,7 @@ class ValuesForTests:
119119

120120
@staticmethod
121121
def get_event(event_name="INSERT", operation="CREATE", supplier="EMIS"):
122-
if operation != "REMOVE":
122+
if operation != EndpointOperationNames.DELETE:
123123
return {
124124
"Records": [
125125
{

0 commit comments

Comments
 (0)