From 8294f66e1d284feb6e6d0e48bbfdf9754adfb331 Mon Sep 17 00:00:00 2001 From: Daniil Nemtsev Date: Tue, 16 Jul 2024 10:39:03 +0200 Subject: [PATCH] Config setting for custom client certificates --- nmostesting/Config.py | 5 +++++ nmostesting/TestHelper.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nmostesting/Config.py b/nmostesting/Config.py index c663ec91d..b39a035ea 100644 --- a/nmostesting/Config.py +++ b/nmostesting/Config.py @@ -104,6 +104,11 @@ "test_data/BCP00301/ca/intermediate/private/rsa.mocks.testsuite.nmos.tv.key.pem" ] +# Combined client certificate and key. +# Can be either path to the combined certificate +# or a tuple of (cert_path, key_path). +CERT_CLIENT = None + # Test using authorization as per AMWA IS-10 and BCP-003-02 ENABLE_AUTH = False diff --git a/nmostesting/TestHelper.py b/nmostesting/TestHelper.py index 7414ccfc5..5983f0d1b 100644 --- a/nmostesting/TestHelper.py +++ b/nmostesting/TestHelper.py @@ -199,7 +199,7 @@ def do_request(method, url, headers=None, **kwargs): req = requests.Request(method, url, headers={k: v for k, v in headers.items() if v is not None}, **kwargs) prepped = s.prepare_request(req) - settings = s.merge_environment_settings(prepped.url, {}, None, CONFIG.CERT_TRUST_ROOT_CA, None) + settings = s.merge_environment_settings(prepped.url, {}, None, CONFIG.CERT_TRUST_ROOT_CA, CONFIG.CERT_CLIENT) response = s.send(prepped, timeout=CONFIG.HTTP_TIMEOUT, **settings) if prepped.url.startswith("https://"): if not response.url.startswith("https://"):