Skip to content

Commit

Permalink
fix: remove duplicate upload, and update tests to capture it (#522)
Browse files Browse the repository at this point in the history
closes #521
  • Loading branch information
lchen-2101 authored Dec 4, 2024
1 parent 091854e commit b500ee2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/sbl_filing_api/services/submission_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ async def validate_and_update_submission(
)
upload_to_storage(period_code, lei, str(submission.counter) + REPORT_QUALIFIER, submission_report)

upload_to_storage(period_code, lei, str(submission.counter) + REPORT_QUALIFIER, submission_report)

if not exec_check["continue"]:
log.warning(f"Submission {submission.id} is expired, will not be updating final state with results.")
return
Expand All @@ -127,8 +125,7 @@ async def validate_and_update_submission(
submission.state = SubmissionState.SUBMISSION_UPLOAD_MALFORMED
await update_submission(session, submission)

except Exception as e:
print(f"{e}")
except Exception:
log.exception("Validation for submission %d did not complete due to an unexpected error.", submission.id)
submission.state = SubmissionState.VALIDATION_ERROR
await update_submission(session, submission)
Expand Down
6 changes: 3 additions & 3 deletions tests/services/test_submission_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def test_validate_and_update_successful(
"2024", "123456790", mock_sub, None, {"continue": True}
)

assert file_mock.mock_calls[0].args == (
file_mock.assert_called_once_with(
"2024",
"123456790",
"2" + submission_processor.REPORT_QUALIFIER,
Expand Down Expand Up @@ -135,7 +135,7 @@ async def test_validate_and_update_warnings(
"2024", "123456790", mock_sub, None, {"continue": True}
)

assert file_mock.mock_calls[0].args == (
file_mock.assert_called_once_with(
"2024",
"123456790",
"3" + submission_processor.REPORT_QUALIFIER,
Expand Down Expand Up @@ -171,7 +171,7 @@ async def test_validate_and_update_errors(
"2024", "123456790", mock_sub, None, {"continue": True}
)

assert file_mock.mock_calls[0].args == (
file_mock.assert_called_once_with(
"2024",
"123456790",
"4" + submission_processor.REPORT_QUALIFIER,
Expand Down

0 comments on commit b500ee2

Please sign in to comment.