mirror of
https://github.com/caronc/apprise.git
synced 2025-06-28 13:42:25 +02:00
apprise.urls() bulletproofing/bugfix (#1302)
This commit is contained in:
parent
bd270efdf8
commit
3cc98662f3
@ -759,7 +759,14 @@ class Apprise:
|
||||
"""
|
||||
Returns all of the loaded URLs defined in this apprise object.
|
||||
"""
|
||||
return [x.url(privacy=privacy) for x in self.servers]
|
||||
urls = []
|
||||
for s in self.servers:
|
||||
if isinstance(s, (ConfigBase, AppriseConfig)):
|
||||
for _s in s.servers():
|
||||
urls.append(_s.url(privacy=privacy))
|
||||
else:
|
||||
urls.append(s.url(privacy=privacy))
|
||||
return urls
|
||||
|
||||
def pop(self, index):
|
||||
"""
|
||||
|
@ -895,6 +895,28 @@ include strict://{}""".format(str(cfg04), str(cfg04), str(cfg04)))
|
||||
assert len(ac.servers()) == 3
|
||||
|
||||
|
||||
def test_apprise_config_file_loading(tmpdir):
|
||||
"""
|
||||
API: AppriseConfig() URL Testing
|
||||
|
||||
"""
|
||||
|
||||
config_path = tmpdir / "apprise.yml"
|
||||
|
||||
# Create a temporary config file
|
||||
config_path.write("urls:\n - json://localhost")
|
||||
|
||||
# Flow from README.md
|
||||
ap = Apprise()
|
||||
ap.add('xml://localhost')
|
||||
config = AppriseConfig()
|
||||
config.add(str(config_path))
|
||||
ap.add(config)
|
||||
|
||||
# Using urls()
|
||||
assert len(ap.urls()) == 2
|
||||
|
||||
|
||||
def test_apprise_config_matrix_load():
|
||||
"""
|
||||
API: AppriseConfig() matrix initialization
|
||||
|
Loading…
x
Reference in New Issue
Block a user