fix: cto= and rto= lines now work from YAML config (#751)

This commit is contained in:
Chris Caron
2022-11-12 10:46:56 -05:00
committed by GitHub
parent 640c00ae70
commit 29e4c5ebd8
2 changed files with 48 additions and 11 deletions

View File

@ -27,6 +27,7 @@ import pytest
from apprise.AppriseAsset import AppriseAsset
from apprise.config.ConfigBase import ConfigBase
from apprise import ConfigFormat
from inspect import cleandoc
import yaml
# Disable logging for a cleaner testing output
@ -957,6 +958,44 @@ def test_yaml_vs_text_tagging():
assert 'mytag' in yaml_result[0]
def test_config_base_config_parse_yaml_globals():
"""
API: ConfigBase.config_parse_yaml globals
"""
# general reference used below
asset = AppriseAsset()
# Invalid Syntax (throws a ScannerError)
results, config = ConfigBase.config_parse_yaml(cleandoc("""
urls:
- jsons://localhost1:
- to: jeff@gmail.com
tag: jeff, customer
cto: 30
rto: 30
verify: no
- jsons://localhost2?cto=30&rto=30&verify=no:
- to: json@gmail.com
tag: json, customer
"""), asset=asset)
# Invalid data gets us an empty result set
assert isinstance(results, list)
# Our results loaded
assert len(results) == 2
assert len(config) == 0
# Now verify that our global variables correctly initialized
for entry in results:
assert entry.verify_certificate is False
assert entry.socket_read_timeout == 30
assert entry.socket_connect_timeout == 30
# 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