mirror of
https://github.com/caronc/apprise.git
synced 2025-03-13 14:28:23 +01:00
apprise.urls() bulletproofing/bugfix
This commit is contained in:
parent
bd270efdf8
commit
d0a1678f1e
@ -759,7 +759,14 @@ class Apprise:
|
|||||||
"""
|
"""
|
||||||
Returns all of the loaded URLs defined in this apprise object.
|
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):
|
def pop(self, index):
|
||||||
"""
|
"""
|
||||||
|
@ -895,6 +895,28 @@ include strict://{}""".format(str(cfg04), str(cfg04), str(cfg04)))
|
|||||||
assert len(ac.servers()) == 3
|
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():
|
def test_apprise_config_matrix_load():
|
||||||
"""
|
"""
|
||||||
API: AppriseConfig() matrix initialization
|
API: AppriseConfig() matrix initialization
|
||||||
|
Loading…
Reference in New Issue
Block a user