diff options
author | Zuul <zuul@review.opendev.org> | 2021-02-17 15:19:10 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-02-17 15:19:10 +0000 |
commit | 66d6ef33ae83ec0b640e11ecfc2b02bc51258776 (patch) | |
tree | d79ec0eec02c84b4c64e6b54a0a9e27315339a46 /oslo_policy | |
parent | d0d8ca541b590d4ccaefa60024204b6966df0f6e (diff) | |
parent | 3e2025b954e909beea1a4b98b5c9aab8b5dc1998 (diff) | |
download | oslo-policy-66d6ef33ae83ec0b640e11ecfc2b02bc51258776.tar.gz |
Merge "tests: Unset requests-related environment variables"
Diffstat (limited to 'oslo_policy')
-rw-r--r-- | oslo_policy/tests/test_external.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/oslo_policy/tests/test_external.py b/oslo_policy/tests/test_external.py index 478920b..797e70f 100644 --- a/oslo_policy/tests/test_external.py +++ b/oslo_policy/tests/test_external.py @@ -16,6 +16,7 @@ import json from unittest import mock +import fixtures from oslo_serialization import jsonutils from requests_mock.contrib import fixture as rm_fixture from urllib import parse as urlparse @@ -155,6 +156,11 @@ class HttpsCheckTestCase(base.PolicyBaseTestCase): opts._register(self.conf) self.requests_mock = self.useFixture(rm_fixture.Fixture()) + # ensure environment variables don't mess with our test results + # https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification + self.useFixture(fixtures.EnvironmentVariable('REQUESTS_CA_BUNDLE')) + self.useFixture(fixtures.EnvironmentVariable('CURL_CA_BUNDLE')) + def decode_post_data(self, post_data): result = {} for item in post_data.split('&'): @@ -203,6 +209,8 @@ class HttpsCheckTestCase(base.PolicyBaseTestCase): def test_https_accept_with_verify(self): self.conf.set_override('remote_ssl_verify_server_crt', True, group='oslo_policy') + self.conf.set_override('remote_ssl_ca_crt_file', None, + group='oslo_policy') self.requests_mock.post('https://example.com/target', text='True') check = _external.HttpsCheck('https', '//example.com/%(name)s') |