Kumulos Support (#151)

This commit is contained in:
Chris Caron
2019-09-11 22:10:32 -04:00
committed by GitHub
parent a459aaffef
commit b2635b8a65
5 changed files with 335 additions and 6 deletions

View File

@ -888,6 +888,55 @@ TEST_URLS = (
'test_requests_exceptions': True,
}),
##################################
# NotifyKumulos
##################################
('kumulos://', {
# No API or Server Key specified
'instance': None,
}),
('kumulos://:@/', {
# No API or Server Key specified
# We don't have strict host checking on for kumulos, so this URL
# actually becomes parseable and :@ becomes a hostname.
# The below errors because a second token wasn't found
'instance': None,
}),
('kumulos://invalid-api-key', {
# Invalid API Key
'instance': TypeError,
}),
('kumulos://{}'.format(UUID4), {
# Server Key not specified
'instance': TypeError,
}),
('kumulos://{}/{}/'.format(UUID4, 'a' * 26), {
# Invalid Server Key
'instance': TypeError,
}),
('kumulos://{}/{}/'.format(UUID4, 'w' * 36), {
# Everything is okay
'instance': plugins.NotifyKumulos,
}),
('kumulos://{}/{}/'.format(UUID4, 'x' * 36), {
'instance': plugins.NotifyKumulos,
# force a failure
'response': False,
'requests_response_code': requests.codes.internal_server_error,
}),
('kumulos://{}/{}/'.format(UUID4, 'y' * 36), {
'instance': plugins.NotifyKumulos,
# throw a bizzare code forcing us to fail to look it up
'response': False,
'requests_response_code': 999,
}),
('kumulos://{}/{}/'.format(UUID4, 'z' * 36), {
'instance': plugins.NotifyKumulos,
# Throws a series of connection and transfer exceptions when this flag
# is set and tests that we gracfully handle them
'test_requests_exceptions': True,
}),
##################################
# NotifyMailgun
##################################
@ -4203,6 +4252,24 @@ def test_notify_ifttt_plugin(mock_post, mock_get):
assert isinstance(obj, plugins.NotifyIFTTT) is True
def test_notify_kumulos_plugin():
"""
API: NotifyKumulos() Extra Checks
"""
# Disable Throttling to speed testing
plugins.NotifyBase.request_rate_per_sec = 0
# Invalid API Key
try:
plugins.NotifyKumulos(None, None)
assert False
except TypeError:
# we'll thrown because an empty list of channels was provided
assert True
@mock.patch('requests.get')
@mock.patch('requests.post')
def test_notify_join_plugin(mock_post, mock_get):