diff --git a/apprise/plugins/NotifyEmail.py b/apprise/plugins/NotifyEmail.py index 381d4dc5..f45822b8 100644 --- a/apprise/plugins/NotifyEmail.py +++ b/apprise/plugins/NotifyEmail.py @@ -291,7 +291,7 @@ class NotifyEmail(NotifyBase): finally: # Gracefully terminate the connection with the server - if socket is not None: # pragma: no branch + if socket is not None: # pragma: no branch socket.quit() return True diff --git a/test/test_cli.py b/test/test_cli.py index febef328..a1843eca 100644 --- a/test/test_cli.py +++ b/test/test_cli.py @@ -72,11 +72,9 @@ def test_apprise_cli(): assert result.exit_code == 0 result = runner.invoke(cli.main, [ - '-t', 'test title', - 'good://localhost', - ], - input='test stdin body\n', - ) + '-t', 'test title', + 'good://localhost', + ], input='test stdin body\n') assert result.exit_code == 0 result = runner.invoke(cli.main, [ diff --git a/test/test_email_plugin.py b/test/test_email_plugin.py index 5c8eb859..f0752cbf 100644 --- a/test/test_email_plugin.py +++ b/test/test_email_plugin.py @@ -291,6 +291,7 @@ def test_webbase_lookup(mock_smtp): assert obj.port == 123 assert obj.smtp_host == 'smtp.l2g.com' + @mock.patch('smtplib.SMTP') def test_smtplib_init_fail(mock_smtplib): """ @@ -323,6 +324,11 @@ def test_smtplib_init_fail(mock_smtplib): # Un-Expected assert False + # A handled and expected exception + mock_smtplib.side_effect = smtplib.SMTPException('Test') + assert obj.notify(title='test', body='body', + notify_type=NotifyType.INFO) is False + @mock.patch('smtplib.SMTP') def test_smtplib_send_okay(mock_smtplib):