diff options
| author | James Falcon <TheRealFalcon@users.noreply.github.com> | 2021-05-14 12:48:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-14 13:48:52 -0400 |
| commit | 57964125205790f7803dbebfadc6c52ed195c6bf (patch) | |
| tree | 89990b0a6c1c91caf619a0043c2d1799d352e0b7 /cloudinit/tests/test_url_helper.py | |
| parent | 864346999702e6b2b8bf7e6244a6608bcead72a5 (diff) | |
| download | vyos-cloud-init-57964125205790f7803dbebfadc6c52ed195c6bf.tar.gz vyos-cloud-init-57964125205790f7803dbebfadc6c52ed195c6bf.zip | |
Fix unit tests breaking from new httpretty version (#903)
httpretty now logs all requests by default which gets mixed up with our
logging tests. Also we were incorrectly setting a logging level to
'None', which now also causes issues with the new httpretty version.
See https://github.com/gabrielfalcao/HTTPretty/pull/419
Diffstat (limited to 'cloudinit/tests/test_url_helper.py')
| -rw-r--r-- | cloudinit/tests/test_url_helper.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/tests/test_url_helper.py b/cloudinit/tests/test_url_helper.py index 364ec822..c3918f80 100644 --- a/cloudinit/tests/test_url_helper.py +++ b/cloudinit/tests/test_url_helper.py @@ -8,6 +8,7 @@ from cloudinit import util from cloudinit import version import httpretty +import logging import requests @@ -81,6 +82,9 @@ class TestReadFileOrUrl(CiTestCase): url = 'http://hostname/path' headers = {'sensitive': 'sekret', 'server': 'blah'} httpretty.register_uri(httpretty.GET, url) + # By default, httpretty will log our request along with the header, + # so if we don't change this the secret will show up in the logs + logging.getLogger('httpretty.core').setLevel(logging.CRITICAL) read_file_or_url(url, headers=headers, headers_redact=['sensitive']) logs = self.logs.getvalue() |
