aboutsummaryrefslogtreecommitdiffstats
path: root/certs/tests
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /certs/tests
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'certs/tests')
-rw-r--r--certs/tests/test_fetch.py35
-rw-r--r--certs/tests/ya.make19
2 files changed, 54 insertions, 0 deletions
diff --git a/certs/tests/test_fetch.py b/certs/tests/test_fetch.py
new file mode 100644
index 0000000000..1a84a7a690
--- /dev/null
+++ b/certs/tests/test_fetch.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+from library.python import resource
+
+import pytest
+import ssl
+# import urllib2
+
+
+class TestRequest(object):
+ @pytest.fixture
+ def ctx(self):
+ r = resource.find("/builtin/cacert")
+ # ssl.create_default_context expects unicode string for pem-coded certificates
+ r = r.decode('ascii', errors='ignore')
+ return ssl.create_default_context(cadata=r)
+
+ def test_certs(self, ctx):
+ assert any(
+ any(item[0] == ("commonName", "YandexInternalRootCA") for item in cert["subject"])
+ for cert in ctx.get_ca_certs()
+ )
+ assert any(
+ any(item[0] == ("commonName", "Certum Trusted Network CA") for item in cert["subject"])
+ for cert in ctx.get_ca_certs()
+ )
+
+ # def test_internal(self, ctx):
+ # connection = urllib2.urlopen("https://nanny.yandex-team.ru/", context=ctx)
+ # assert connection.read()
+
+ # def test_external(self, ctx):
+ # connection = urllib2.urlopen("https://docs.python.org/", context=ctx)
+ # assert connection.read()
diff --git a/certs/tests/ya.make b/certs/tests/ya.make
new file mode 100644
index 0000000000..7064b67f51
--- /dev/null
+++ b/certs/tests/ya.make
@@ -0,0 +1,19 @@
+PY2TEST()
+
+OWNER(
+ g:util
+ g:juggler
+)
+
+TEST_SRCS(test_fetch.py)
+
+TAG(ya:external)
+
+REQUIREMENTS(network:full)
+
+PEERDIR(
+ library/python/resource
+ certs
+)
+
+END()