Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from aws_lambda_powertools.utilities.typing import LambdaContext
from botocore.exceptions import ClientError
from botocore.response import StreamingBody
from marshmallow.exceptions import SCHEMA

from cc_common.config import config, logger
from cc_common.data_model.schema.license.api import (
LicensePostRequestSchema,
Expand Down Expand Up @@ -164,11 +166,16 @@ def process_bulk_upload_file(
if duplicate_ssn_check_flag_enabled:
matched_ssn_index = ssns_in_file_upload.get(ssn_key)
if matched_ssn_index:
# format the validation error as dict so it can be processed by email handler downstream
raise ValidationError(
message=f'Duplicate License SSN detected for license type '
f'{validated_license["licenseType"]}. SSN matches with record '
f'{matched_ssn_index}. Every record must have a unique SSN per license type '
f'within the same file.'
{
SCHEMA: [
f'Duplicate License SSN detected for license type '
f'{validated_license["licenseType"]}. SSN matches with record '
f'{matched_ssn_index}. Every record must have a unique SSN per license type '
f'within the same file.'
]
}
)
ssns_in_file_upload.update({ssn_key: i + 1})
except TypeError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,9 @@ def test_bulk_upload_prevents_repeated_ssns_within_the_same_file_upload(self):
'dateOfRenewal': '2025-01-01',
'dateOfExpiration': '2026-01-01',
},
'errors': [
'Duplicate License SSN detected for license type audiologist. SSN matches with record 1. '
'Every record must have a unique SSN per license type within the same file.'
],
}
"errors": {"_schema": ["Duplicate License SSN detected for license type audiologist. "
"SSN matches with record 1. Every record must have a unique SSN per"
" license type within the same file."]}}
),
'EventBusName': 'license-data-events',
}
Expand Down
Loading