From 9bd068b274adee50b5a639a45be477a4332c67f0 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Tue, 27 Aug 2024 18:04:30 -0400 Subject: [PATCH] test coverage + bugfix --- apprise/plugins/pushsafer.py | 2 +- test/test_plugin_sendgrid.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apprise/plugins/pushsafer.py b/apprise/plugins/pushsafer.py index 48ae37d3..da4277de 100644 --- a/apprise/plugins/pushsafer.py +++ b/apprise/plugins/pushsafer.py @@ -575,7 +575,7 @@ class NotifyPushSafer(NotifyBase): attachment.name, 'data:{};base64,{}'.format( attachment.mimetype, - attachment.base64, + attachment.base64(), ) )) diff --git a/test/test_plugin_sendgrid.py b/test/test_plugin_sendgrid.py index 4c775ca0..eb48befa 100644 --- a/test/test_plugin_sendgrid.py +++ b/test/test_plugin_sendgrid.py @@ -196,6 +196,12 @@ def test_plugin_sendgrid_attachments(mock_post, mock_get): mock_post.reset_mock() mock_get.reset_mock() + # Try again in a use case where we can't access the file + with mock.patch("os.path.isfile", return_value=False): + assert obj.notify( + body='body', title='title', notify_type=NotifyType.INFO, + attach=attach) is False + # Try again in a use case where we can't access the file with mock.patch("builtins.open", side_effect=OSError): assert obj.notify(