diff options
author | James Falcon <TheRealFalcon@users.noreply.github.com> | 2021-05-11 11:34:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 11:34:29 -0500 |
commit | 899bfaa9d6bfab1db0df99257628ca1f6febff60 (patch) | |
tree | c52c6d3af423e8877803f48472b9c495fed4fd2c /cloudinit/distros | |
parent | 77320bfcdafa4ba63bb59be63d11c4d7414e5f92 (diff) | |
download | vyos-cloud-init-899bfaa9d6bfab1db0df99257628ca1f6febff60.tar.gz vyos-cloud-init-899bfaa9d6bfab1db0df99257628ca1f6febff60.zip |
Update test characters in substitution unit test (#893)
In newer versions of python, when using urllib.parse, lines containing
newline or tab characters now get sanitized. This caused a unit test to
fail.
See https://bugs.python.org/issue43882
Diffstat (limited to 'cloudinit/distros')
-rw-r--r-- | cloudinit/distros/tests/test_init.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/distros/tests/test_init.py b/cloudinit/distros/tests/test_init.py index db534654..fd64a322 100644 --- a/cloudinit/distros/tests/test_init.py +++ b/cloudinit/distros/tests/test_init.py @@ -11,10 +11,15 @@ import pytest from cloudinit.distros import _get_package_mirror_info, LDH_ASCII_CHARS +# In newer versions of Python, these characters will be omitted instead +# of substituted because of security concerns. +# See https://bugs.python.org/issue43882 +SECURITY_URL_CHARS = '\n\r\t' # Define a set of characters we would expect to be replaced INVALID_URL_CHARS = [ - chr(x) for x in range(127) if chr(x) not in LDH_ASCII_CHARS + chr(x) for x in range(127) + if chr(x) not in LDH_ASCII_CHARS + SECURITY_URL_CHARS ] for separator in [":", ".", "/", "#", "?", "@", "[", "]"]: # Remove from the set characters that either separate hostname parts (":", |