OneSignal code cleanup

This commit is contained in:
Chris Caron 2020-12-30 16:29:23 -05:00
parent ed04898ec4
commit 4037d8726e
2 changed files with 17 additions and 1 deletions

View File

@ -396,6 +396,7 @@ class NotifyOneSignal(NotifyBase):
# Define any URL parameters
params = {
'image': 'yes' if self.include_image else 'no',
'batch': 'yes' if self.batch_size > 1 else 'no',
}
# Extend our parameters
@ -453,10 +454,17 @@ class NotifyOneSignal(NotifyBase):
'image',
NotifyOneSignal.template_args['image']['default']))
# Get Batch Boolean (if set)
results['batch'] = \
parse_bool(
results['qsd'].get(
'batch',
NotifyOneSignal.template_args['batch']['default']))
# The API Key is stored in the hostname
results['apikey'] = NotifyOneSignal.unquote(results['host'])
# Get our Device IDs
# Get our Targets
results['targets'] = NotifyOneSignal.split_path(results['fullpath'])
# The 'to' makes it easier to use yaml configuration

View File

@ -2371,6 +2371,14 @@ TEST_URLS = (
# Test to=
'instance': plugins.NotifyOneSignal,
}),
('onesignal://appid@apikey/#segment/@user/?batch=yes', {
# Test batch=
'instance': plugins.NotifyOneSignal,
}),
('onesignal://appid@apikey/#segment/@user/?batch=no', {
# Test batch=
'instance': plugins.NotifyOneSignal,
}),
('onesignal://templateid:appid@apikey/playerid', {
# Test Template ID
'instance': plugins.NotifyOneSignal,