mirror of
https://github.com/caronc/apprise.git
synced 2025-02-18 11:11:07 +01:00
coverage updates (keep to 100%)
This commit is contained in:
parent
1e4f38e6cb
commit
91cf3fa625
@ -205,7 +205,8 @@ class Apprise(object):
|
|||||||
if not instance:
|
if not instance:
|
||||||
return_status = False
|
return_status = False
|
||||||
logging.error(
|
logging.error(
|
||||||
"Failed to load notification url: {}".format(_server))
|
"Failed to load notification url: {}".format(_server),
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Add our initialized plugin to our server listings
|
# Add our initialized plugin to our server listings
|
||||||
|
@ -155,6 +155,11 @@ def test_apprise():
|
|||||||
# Pretend everything is okay
|
# Pretend everything is okay
|
||||||
raise TypeError()
|
raise TypeError()
|
||||||
|
|
||||||
|
class RuntimeNotification(NotifyBase):
|
||||||
|
def notify(self, **kwargs):
|
||||||
|
# Pretend everything is okay
|
||||||
|
raise RuntimeError()
|
||||||
|
|
||||||
class FailNotification(NotifyBase):
|
class FailNotification(NotifyBase):
|
||||||
|
|
||||||
def notify(self, **kwargs):
|
def notify(self, **kwargs):
|
||||||
@ -167,15 +172,19 @@ def test_apprise():
|
|||||||
# Store our good notification in our schema map
|
# Store our good notification in our schema map
|
||||||
SCHEMA_MAP['fail'] = FailNotification
|
SCHEMA_MAP['fail'] = FailNotification
|
||||||
|
|
||||||
|
# Store our good notification in our schema map
|
||||||
|
SCHEMA_MAP['runtime'] = RuntimeNotification
|
||||||
|
|
||||||
|
assert(a.add('runtime://localhost') is True)
|
||||||
assert(a.add('throw://localhost') is True)
|
assert(a.add('throw://localhost') is True)
|
||||||
assert(a.add('fail://localhost') is True)
|
assert(a.add('fail://localhost') is True)
|
||||||
assert(len(a) == 2)
|
assert(len(a) == 3)
|
||||||
|
|
||||||
# Test when our notify both throws an exception and or just
|
# Test when our notify both throws an exception and or just
|
||||||
# simply returns False
|
# simply returns False
|
||||||
assert(a.notify(title="present", body="present") is False)
|
assert(a.notify(title="present", body="present") is False)
|
||||||
|
|
||||||
# Test instantiating a plugin
|
# Create a Notification that throws an unexected exception
|
||||||
class ThrowInstantiateNotification(NotifyBase):
|
class ThrowInstantiateNotification(NotifyBase):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
# Pretend everything is okay
|
# Pretend everything is okay
|
||||||
|
Loading…
Reference in New Issue
Block a user