aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest-localserver/py3/tests/test_https.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2025-02-02 10:11:17 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2025-02-02 10:21:23 +0300
commit637f8bbf610e99859dfbdbde49d99e9c60a7acf7 (patch)
tree3e685433e89f53a34ca2a4635c29865598d12b4f /contrib/python/pytest-localserver/py3/tests/test_https.py
parentbbd3eacdd0520f608b6290efdd0050d7e55ad40d (diff)
downloadydb-637f8bbf610e99859dfbdbde49d99e9c60a7acf7.tar.gz
Intermediate changes
commit_hash:20c3eb2f2d78b5f654ec928c071692413a1bd96d
Diffstat (limited to 'contrib/python/pytest-localserver/py3/tests/test_https.py')
-rw-r--r--contrib/python/pytest-localserver/py3/tests/test_https.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/python/pytest-localserver/py3/tests/test_https.py b/contrib/python/pytest-localserver/py3/tests/test_https.py
index 4c676d1753..d66450b5bb 100644
--- a/contrib/python/pytest-localserver/py3/tests/test_https.py
+++ b/contrib/python/pytest-localserver/py3/tests/test_https.py
@@ -1,3 +1,4 @@
+import pytest
import requests
from pytest_localserver import https
@@ -41,3 +42,16 @@ def test_HEAD_request(httpsserver):
resp = requests.head(httpsserver.url, verify=False)
assert resp.status_code == 200
assert resp.headers["Content-type"] == "text/plain"
+
+
+def test_client_does_not_trust_self_signed_certificate(httpsserver):
+ httpsserver.serve_content("TEST!", headers={"Content-type": "text/plain"})
+ with pytest.raises(requests.exceptions.SSLError, match="CERTIFICATE_VERIFY_FAILED"):
+ requests.get(httpsserver.url, verify=True)
+
+
+def test_add_server_certificate_to_client_trust_chain(httpsserver):
+ httpsserver.serve_content("TEST!", headers={"Content-type": "text/plain"})
+ resp = requests.get(httpsserver.url, verify=httpsserver.certificate)
+ assert resp.status_code == 200
+ assert resp.headers["Content-type"] == "text/plain"