mirror of
https://github.com/caronc/apprise.git
synced 2025-12-15 10:04:06 +08:00
Return target count from len(Service) calls (#874)
This commit is contained in:
@@ -203,6 +203,9 @@ class AppriseURLTester:
|
||||
# this url
|
||||
assert isinstance(obj.url(), str) is True
|
||||
|
||||
# Verify we can acquire a target count as an integer
|
||||
assert isinstance(len(obj), int)
|
||||
|
||||
# Test url() with privacy=True
|
||||
assert isinstance(
|
||||
obj.url(privacy=True), str) is True
|
||||
@@ -240,6 +243,14 @@ class AppriseURLTester:
|
||||
url, obj.url()))
|
||||
assert False
|
||||
|
||||
# Verify there is no change from the old and the new
|
||||
if len(obj) != len(obj_cmp):
|
||||
print('%d targets found in %s' % (
|
||||
len(obj), obj.url(privacy=True)))
|
||||
print('But %d targets found in %s' % (
|
||||
len(obj_cmp), obj_cmp.url(privacy=True)))
|
||||
raise AssertionError("Target miscount %d != %d")
|
||||
|
||||
# Tidy our object
|
||||
del obj_cmp
|
||||
|
||||
@@ -371,11 +382,19 @@ class AppriseURLTester:
|
||||
try:
|
||||
if test_requests_exceptions is False:
|
||||
|
||||
# Verify we can acquire a target count as an integer
|
||||
targets = len(obj)
|
||||
|
||||
# check that we're as expected
|
||||
assert obj.notify(
|
||||
body=self.body, title=self.title,
|
||||
notify_type=notify_type) == notify_response
|
||||
|
||||
if notify_response:
|
||||
# If we successfully got a response, there must have been
|
||||
# at least 1 target present
|
||||
assert targets > 0
|
||||
|
||||
# check that this doesn't change using different overflow
|
||||
# methods
|
||||
assert obj.notify(
|
||||
@@ -447,6 +466,7 @@ class AppriseURLTester:
|
||||
os.path.join(self.__test_var_dir, 'apprise-test.png'),
|
||||
os.path.join(self.__test_var_dir, 'apprise-test.jpeg'),
|
||||
))
|
||||
|
||||
assert obj.notify(
|
||||
body=self.body, title=self.title,
|
||||
notify_type=notify_type,
|
||||
|
||||
Reference in New Issue
Block a user