Skip to content

Commit

Permalink
updated to fit with recent global changes
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Jul 1, 2023
1 parent 34b34da commit 9c83973
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
7 changes: 7 additions & 0 deletions apprise/plugins/NotifyOctopush.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class NotifyOctopush(NotifyBase):
'targets': {
'name': _('Targets'),
'type': 'list:string',
'required': True,
},
})

Expand Down Expand Up @@ -409,6 +410,12 @@ def url(self, privacy=False, *args, **kwargs):
params=NotifyOctopush.urlencode(params),
)

def __len__(self):
"""
Returns the number of targets associated with this notification
"""
return len(self.targets)

@staticmethod
def parse_url(url):
"""
Expand Down
20 changes: 10 additions & 10 deletions test/test_plugin_octopush.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,59 +57,59 @@
}),
('octopush://[email protected]/apikey', {
# All valid entries, but no target phone numbers defined
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
'response': False,
}),
('octopush://[email protected]/apikey/+0987654321', {
# A valid url
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'octopush://u...m/****/+0987654321',
}),
('octopush://sender:[email protected]/apikey/+1111111111', {
# A valid url with sender
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'octopush://sender:u...m/****/+1111111111',
}),
('octopush://[email protected]&key=key&to=9999999999'
'&purpose=wholesale', {
# Testing valid purpose change
'instance': plugins.NotifyOctopush}),
'instance': plugins.NotifyOctopush.NotifyOctopush}),
('octopush://[email protected]&key=key&to=9999999999'
'&purpose=invalid', {
# Testing invalid purpose change
'instance': TypeError}),
('octopush://[email protected]&key=key&to=9999999999'
'&type=premium', {
# Testing valid type change
'instance': plugins.NotifyOctopush}),
'instance': plugins.NotifyOctopush.NotifyOctopush}),
('octopush://[email protected]&key=key&to=9999999999'
'&type=invalid', {
# Testing invalid type change
'instance': TypeError}),
('octopush://[email protected]/apikey/+3333333333?replies=yes', {
# Test replies
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
}),
('octopush://sender:[email protected]/apikey/{}/{}/{}/?batch=yes'.format(
'1' * 10, '2' * 3, '3' * 11), {
# batch mode, 2 valid targets (1 is invalid and skipped)
'instance': plugins.NotifyOctopush}),
'instance': plugins.NotifyOctopush.NotifyOctopush}),
('octopush://_?key=abc123&login=user@myaccount&sender=abc&to=2222222222', {
# use get args to acomplish the same thing
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'octopush://abc:u...t/****/+2222222222',
}),
('octopush://[email protected]/apikey/1234567890', {
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
# throw a bizzare code forcing us to fail to look it up
'response': False,
'requests_response_code': 999,
}),
('octopush://[email protected]/apikey/1234567890', {
'instance': plugins.NotifyOctopush,
'instance': plugins.NotifyOctopush.NotifyOctopush,
# Throws a series of connection and transfer exceptions when this flag
# is set and tests that we gracfully handle them
'test_requests_exceptions': True,
Expand Down

0 comments on commit 9c83973

Please sign in to comment.