Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Oct 10, 2023
1 parent 4f87730 commit 1abe3d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

from weaver.datatype import Job
from weaver.notify import decrypt_email, encrypt_email, notify_job_complete
from weaver.notify import decrypt_email, encrypt_email, notify_job_email
from weaver.status import Status


Expand Down Expand Up @@ -74,7 +74,7 @@ def test_notify_email_job_complete():
mock_smtp.return_value.sendmail.return_value = None # sending worked

test_job.status = Status.SUCCEEDED
notify_job_complete(test_job, notify_email, settings)
notify_job_email(test_job, notify_email, settings)
mock_smtp.assert_called_with("xyz.test.com", 12345, timeout=1)
assert mock_smtp.return_value.sendmail.call_args[0][0] == "[email protected]"
assert mock_smtp.return_value.sendmail.call_args[0][1] == notify_email
Expand All @@ -89,7 +89,7 @@ def test_notify_email_job_complete():
assert test_job_err_url not in message

test_job.status = Status.FAILED
notify_job_complete(test_job, notify_email, settings)
notify_job_email(test_job, notify_email, settings)
assert mock_smtp.return_value.sendmail.call_args[0][0] == "[email protected]"
assert mock_smtp.return_value.sendmail.call_args[0][1] == notify_email
message_encoded = mock_smtp.return_value.sendmail.call_args[0][2]
Expand All @@ -103,7 +103,7 @@ def test_notify_email_job_complete():
assert test_job_err_url in message


def test_notify_job_complete_custom_template():
def test_notify_job_email_custom_template():
with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", suffix=".mako") as email_template_file:
email_template_file.writelines([
"From: Weaver\n",
Expand Down Expand Up @@ -137,7 +137,7 @@ def test_notify_job_complete_custom_template():

with mock.patch("smtplib.SMTP_SSL", autospec=smtplib.SMTP_SSL) as mock_smtp:
mock_smtp.return_value.sendmail.return_value = None # sending worked
notify_job_complete(test_job, notify_email, settings)
notify_job_email(test_job, notify_email, settings)

message_encoded = mock_smtp.return_value.sendmail.call_args[0][2]
message = message_encoded.decode("utf8")
Expand Down

0 comments on commit 1abe3d5

Please sign in to comment.