SHA256
1
0
forked from pool/cloud-init
cloud-init/cloud-init-update-test-characters-in-substitution-unit-test.patch
Robert Schweikert bf3841c6e3 Accepting request 911508 from home:fusionfuture:branches:Cloud:Tools
- Add cloud-init-update-test-characters-in-substitution-unit-test.patch
  to fix unit test fail in TestGetPackageMirrorInfo::test_substitution.

OBS-URL: https://build.opensuse.org/request/show/911508
OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=188
2021-08-12 11:24:32 +00:00

20 lines
776 B
Diff

--- 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 (":",