Skip to content

Commit b500ee2

Browse files
authored
fix: remove duplicate upload, and update tests to capture it (#522)
closes #521
1 parent 091854e commit b500ee2

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/sbl_filing_api/services/submission_processor.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ async def validate_and_update_submission(
114114
)
115115
upload_to_storage(period_code, lei, str(submission.counter) + REPORT_QUALIFIER, submission_report)
116116

117-
upload_to_storage(period_code, lei, str(submission.counter) + REPORT_QUALIFIER, submission_report)
118-
119117
if not exec_check["continue"]:
120118
log.warning(f"Submission {submission.id} is expired, will not be updating final state with results.")
121119
return
@@ -127,8 +125,7 @@ async def validate_and_update_submission(
127125
submission.state = SubmissionState.SUBMISSION_UPLOAD_MALFORMED
128126
await update_submission(session, submission)
129127

130-
except Exception as e:
131-
print(f"{e}")
128+
except Exception:
132129
log.exception("Validation for submission %d did not complete due to an unexpected error.", submission.id)
133130
submission.state = SubmissionState.VALIDATION_ERROR
134131
await update_submission(session, submission)

tests/services/test_submission_processor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async def test_validate_and_update_successful(
9999
"2024", "123456790", mock_sub, None, {"continue": True}
100100
)
101101

102-
assert file_mock.mock_calls[0].args == (
102+
file_mock.assert_called_once_with(
103103
"2024",
104104
"123456790",
105105
"2" + submission_processor.REPORT_QUALIFIER,
@@ -135,7 +135,7 @@ async def test_validate_and_update_warnings(
135135
"2024", "123456790", mock_sub, None, {"continue": True}
136136
)
137137

138-
assert file_mock.mock_calls[0].args == (
138+
file_mock.assert_called_once_with(
139139
"2024",
140140
"123456790",
141141
"3" + submission_processor.REPORT_QUALIFIER,
@@ -171,7 +171,7 @@ async def test_validate_and_update_errors(
171171
"2024", "123456790", mock_sub, None, {"continue": True}
172172
)
173173

174-
assert file_mock.mock_calls[0].args == (
174+
file_mock.assert_called_once_with(
175175
"2024",
176176
"123456790",
177177
"4" + submission_processor.REPORT_QUALIFIER,

0 commit comments

Comments
 (0)