From ddb48ff6b8f49d2bc59e1d6bc1a7c97399dc3b1a Mon Sep 17 00:00:00 2001 From: Dominik Rimpf Date: Sun, 18 Dec 2022 22:41:52 +0100 Subject: [PATCH 1/3] fix pass all provided arguments to token auth-backend --- proxmoxer/backends/https.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proxmoxer/backends/https.py b/proxmoxer/backends/https.py index 2bb054d..191e67a 100644 --- a/proxmoxer/backends/https.py +++ b/proxmoxer/backends/https.py @@ -287,7 +287,14 @@ def __init__( if "token" not in SERVICES[service]["supported_https_auths"]: config_failure("{} does not support API Token authentication", service) - self.auth = ProxmoxHTTPApiTokenAuth(user, token_name, token_value, service=service) + self.auth = ProxmoxHTTPApiTokenAuth( + user, + token_name, + token_value, + verify_ssl=verify_ssl, + timeout=timeout, + service=service + ) elif password is not None: if "password" not in SERVICES[service]["supported_https_auths"]: config_failure("{} does not support password authentication", service) From f84fcfc90738bc2288cf59c23308e0a1ed5b0675 Mon Sep 17 00:00:00 2001 From: Dominik Rimpf Date: Sun, 18 Dec 2022 23:10:01 +0100 Subject: [PATCH 2/3] add test to check correct propagation of verify_ssl --- tests/test_https.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_https.py b/tests/test_https.py index 97e2f61..69d7d08 100644 --- a/tests/test_https.py +++ b/tests/test_https.py @@ -108,6 +108,22 @@ def test_get_tokens_password(self, mock_pve): assert ("ticket", "CSRFPreventionToken") == backend.get_tokens() + def test_verify_ssl_token(self): + backend = https.Backend("1.2.3.4:1234", token_name="name") + assert backend.auth.verify_ssl is True + + def test_verify_ssl_false_token(self): + backend = https.Backend("1.2.3.4:1234", token_name="name", verify_ssl=False) + assert backend.auth.verify_ssl is False + + def test_verify_ssl_password(self, mock_pve): + backend = https.Backend("1.2.3.4:1234", password="name") + assert backend.auth.verify_ssl is True + + def test_verify_ssl_false_password(self, mock_pve): + backend = https.Backend("1.2.3.4:1234", password="name", verify_ssl=False) + assert backend.auth.verify_ssl is False + class TestProxmoxHTTPAuthBase: """ From 0f9933646665b53193675c9505d3f4010be1a2ce Mon Sep 17 00:00:00 2001 From: Dominik Rimpf Date: Mon, 19 Dec 2022 10:45:21 +0100 Subject: [PATCH 3/3] FIX: black linting error --- proxmoxer/backends/https.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmoxer/backends/https.py b/proxmoxer/backends/https.py index 191e67a..6d238f5 100644 --- a/proxmoxer/backends/https.py +++ b/proxmoxer/backends/https.py @@ -293,7 +293,7 @@ def __init__( token_value, verify_ssl=verify_ssl, timeout=timeout, - service=service + service=service, ) elif password is not None: if "password" not in SERVICES[service]["supported_https_auths"]: