|
|
@ -28,6 +28,7 @@ import pytest |
|
|
|
from apprise.AppriseAsset import AppriseAsset |
|
|
|
from apprise.AppriseAsset import AppriseAsset |
|
|
|
from apprise.config.ConfigBase import ConfigBase |
|
|
|
from apprise.config.ConfigBase import ConfigBase |
|
|
|
from apprise import ConfigFormat |
|
|
|
from apprise import ConfigFormat |
|
|
|
|
|
|
|
import yaml |
|
|
|
|
|
|
|
|
|
|
|
# Disable logging for a cleaner testing output |
|
|
|
# Disable logging for a cleaner testing output |
|
|
|
import logging |
|
|
|
import logging |
|
|
@ -490,26 +491,6 @@ urls: |
|
|
|
# There were no include entries defined |
|
|
|
# There were no include entries defined |
|
|
|
assert len(config) == 0 |
|
|
|
assert len(config) == 0 |
|
|
|
|
|
|
|
|
|
|
|
# Invalid url/schema |
|
|
|
|
|
|
|
result, config = ConfigBase.config_parse_yaml(""" |
|
|
|
|
|
|
|
# no lists... just no |
|
|
|
|
|
|
|
urls: [milk, pumpkin pie, eggs, juice] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Including by list is okay |
|
|
|
|
|
|
|
include: [file:///absolute/path/, relative/path, http://test.com] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""", asset=asset) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Invalid data gets us an empty result set |
|
|
|
|
|
|
|
assert isinstance(result, list) |
|
|
|
|
|
|
|
assert len(result) == 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# There were 3 include entries |
|
|
|
|
|
|
|
assert len(config) == 3 |
|
|
|
|
|
|
|
assert 'file:///absolute/path/' in config |
|
|
|
|
|
|
|
assert 'relative/path' in config |
|
|
|
|
|
|
|
assert 'http://test.com' in config |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Invalid url/schema |
|
|
|
# Invalid url/schema |
|
|
|
result, config = ConfigBase.config_parse_yaml(""" |
|
|
|
result, config = ConfigBase.config_parse_yaml(""" |
|
|
|
urls: |
|
|
|
urls: |
|
|
@ -906,3 +887,39 @@ include: |
|
|
|
assert 'http://localhost/apprise/cfg01' in config |
|
|
|
assert 'http://localhost/apprise/cfg01' in config |
|
|
|
assert 'http://localhost/apprise/cfg02' in config |
|
|
|
assert 'http://localhost/apprise/cfg02' in config |
|
|
|
assert 'http://localhost/apprise/cfg03' in config |
|
|
|
assert 'http://localhost/apprise/cfg03' in config |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This test fails on CentOS 8.x so it was moved into it's own function |
|
|
|
|
|
|
|
# so it could be bypassed. The ability to use lists in YAML files didn't |
|
|
|
|
|
|
|
# appear to happen until later on; it's certainly not available in v3.12 |
|
|
|
|
|
|
|
# which was what shipped with CentOS v8 at the time. |
|
|
|
|
|
|
|
@pytest.mark.skipif(int(yaml.__version__.split('.')[0]) <= 3, |
|
|
|
|
|
|
|
reason="requires pyaml v4.x or higher.") |
|
|
|
|
|
|
|
def test_config_base_config_parse_yaml_list(): |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
API: ConfigBase.config_parse_yaml list parsing |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# general reference used below |
|
|
|
|
|
|
|
asset = AppriseAsset() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Invalid url/schema |
|
|
|
|
|
|
|
result, config = ConfigBase.config_parse_yaml(""" |
|
|
|
|
|
|
|
# no lists... just no |
|
|
|
|
|
|
|
urls: [milk, pumpkin pie, eggs, juice] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Including by list is okay |
|
|
|
|
|
|
|
include: [file:///absolute/path/, relative/path, http://test.com] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""", asset=asset) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Invalid data gets us an empty result set |
|
|
|
|
|
|
|
assert isinstance(result, list) |
|
|
|
|
|
|
|
assert len(result) == 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# There were 3 include entries |
|
|
|
|
|
|
|
assert len(config) == 3 |
|
|
|
|
|
|
|
assert 'file:///absolute/path/' in config |
|
|
|
|
|
|
|
assert 'relative/path' in config |
|
|
|
|
|
|
|
assert 'http://test.com' in config |
|
|
|