@@ -168,32 +168,37 @@ def test_compress_file(
168168
169169
170170@pytest .mark .parametrize (
171- "sendmail_error, expected_log_message" ,
171+ "new_status, sendmail_error, expected_log_message" ,
172172 [
173173 # Normal case: No errors, should not log anything
174174 # No logs are expected, everything works fine
175- (None , None ),
175+ (Status . VALUE_TO_KEY [ Status . FAILED ], None , None ),
176176
177177 # Log connection error: Simulate an error while sending email
178- (Exception ("SMTP server error" ),
179- 'Trace:SMTP server error\n An error has occurred while sending a mail for the job Job1' )
178+ (Status .VALUE_TO_KEY [Status .FAILED ], Exception ("SMTP server error" ),
179+ 'Trace:SMTP server error\n An error has occurred while sending a mail for the job Job1' ),
180+
181+ # Job is now failing
182+ (Status .VALUE_TO_KEY [Status .COMPLETED ], None , None )
180183 ],
181184 ids = [
182185 "Normal case: No errors" ,
183- "Log connection error (SMTP server error)"
186+ "Log connection error (SMTP server error)" ,
187+ "No notification needed"
184188 ]
185189)
186190def test_notify_status_change (
187191 mock_basic_config ,
188192 mock_smtp ,
189193 mocker ,
190194 mail_notifier ,
195+ new_status ,
191196 sendmail_error : Optional [Exception ],
192197 expected_log_message ):
193198 exp_id = 'a123'
194199 job_name = 'Job1'
195200 prev_status = Status .VALUE_TO_KEY [Status .RUNNING ]
196- status = Status . VALUE_TO_KEY [ Status . COMPLETED ]
201+ status = new_status
197202198203
199204 mock_smtp = mocker .patch (
0 commit comments