diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /certs/tests | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'certs/tests')
-rw-r--r-- | certs/tests/test_fetch.py | 35 | ||||
-rw-r--r-- | certs/tests/ya.make | 19 |
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() |