From 899bfaa9d6bfab1db0df99257628ca1f6febff60 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Tue, 11 May 2021 11:34:29 -0500 Subject: 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 --- cloudinit/distros/tests/test_init.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cloudinit') 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 (":", -- cgit v1.2.3