Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: HTTPS Token Auth verify_ssl propagation #128

Merged
merged 3 commits into from Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion proxmoxer/backends/https.py
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_https.py
Expand Up @@ -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:
"""
Expand Down