test coverage + bugfix

pull/1191/head
Chris Caron 3 months ago
parent 7e12e1d54a
commit 9bd068b274

@ -575,7 +575,7 @@ class NotifyPushSafer(NotifyBase):
attachment.name,
'data:{};base64,{}'.format(
attachment.mimetype,
attachment.base64,
attachment.base64(),
)
))

@ -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(

Loading…
Cancel
Save