From e357e30b435a58c56314c5c480c7cfa9fadd8805 Mon Sep 17 00:00:00 2001 From: Aimee Gao Date: Thu, 10 Oct 2024 15:45:53 -0700 Subject: [PATCH 1/2] Fix bug --- jobs/furnishings/src/furnishings/stage_processors/stage_one.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jobs/furnishings/src/furnishings/stage_processors/stage_one.py b/jobs/furnishings/src/furnishings/stage_processors/stage_one.py index 9be017e9e..be07fc1e2 100644 --- a/jobs/furnishings/src/furnishings/stage_processors/stage_one.py +++ b/jobs/furnishings/src/furnishings/stage_processors/stage_one.py @@ -126,6 +126,7 @@ def update_notes_and_status(self, furnishings_list, funishing_status, furnishing for furnishing in furnishings_list: furnishing.notes = furnishing_notes furnishing.status = funishing_status + furnishing.processed_date = datetime.utcnow() furnishing.save() def process_paper_letters(self): @@ -163,7 +164,7 @@ def process_paper_letters(self): with self._bcmail_sftp_connection as client: resp = self.upload_to_sftp(client, self._xpro_letters, filename) self.update_notes_and_status( - self._bc_mail_furnishings, + self._xpro_mail_furnishings, Furnishing.FurnishingStatus.PROCESSED, 'SFTP of XPRO batch letter was a success.' ) From 419639e5ec281d7b84eef5234ebd33037b1c4b11 Mon Sep 17 00:00:00 2001 From: Aimee Gao Date: Thu, 10 Oct 2024 15:46:22 -0700 Subject: [PATCH 2/2] Update unit tests --- .../tests/unit/stage_processors/test_stage_one.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jobs/furnishings/tests/unit/stage_processors/test_stage_one.py b/jobs/furnishings/tests/unit/stage_processors/test_stage_one.py index 770f95c7f..69497c7cc 100644 --- a/jobs/furnishings/tests/unit/stage_processors/test_stage_one.py +++ b/jobs/furnishings/tests/unit/stage_processors/test_stage_one.py @@ -329,3 +329,16 @@ async def test_process_paper_letters(app, session, sftpserver, sftpconnection, t with sftpconnection as sftpclient: uploaded_files = sftpclient.listdir(storage_directory) assert len(uploaded_files) == 1 + + # Fetch the updated furnishing + updated_furnishing = Furnishing.find_by_id(mail_furnishing.id) + + # Assert the status is updated correctly + assert updated_furnishing.status == Furnishing.FurnishingStatus.PROCESSED + + # Assert the processed_date is set + assert updated_furnishing.processed_date is not None + + # Assert the correct note is added based on the entity type + expected_note = 'SFTP of BC batch letter was a success' if entity_type == Business.LegalTypes.COMP.value else 'SFTP of XPRO batch letter was a success' + assert expected_note in updated_furnishing.notes