diff options
author | Joffrey F <joffrey@docker.com> | 2016-02-03 17:50:52 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2016-02-03 17:50:52 -0800 |
commit | b808cc45b43a2de397e7e0fb2eb8c2d98250e263 (patch) | |
tree | 3a5c605324c220b3862f476fbb135d68c969b0ac /tests | |
parent | a6a562a68102f548e87781a338219685b066c412 (diff) | |
download | docker-py-ssl_version_simpler.tar.gz |
Remove obsolete SSL version computationssl_version_simpler
Recent versions of urllib3 (including the one packaged by requests)
will automatically reject SSLv2/3.
Additional test to check urllib3's behavior (mostly for release/packaging)
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/utils_test.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index 63ea10e..01d7268 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -12,9 +12,17 @@ import tempfile import pytest import six +try: + from ssl import OP_NO_SSLv3, OP_NO_SSLv2, OP_NO_TLSv1 +except ImportError: + OP_NO_SSLv2 = 0x1000000 + OP_NO_SSLv3 = 0x2000000 + OP_NO_TLSv1 = 0x4000000 + from docker.client import Client from docker.constants import DEFAULT_DOCKER_API_VERSION from docker.errors import DockerException, InvalidVersion +from docker.ssladapter import ssladapter from docker.utils import ( parse_repository_tag, parse_host, convert_filters, kwargs_from_env, create_host_config, Ulimit, LogConfig, parse_bytes, parse_env_file, @@ -872,3 +880,12 @@ class TarTest(base.Cleanup, base.BaseTestCase): self.assertEqual( sorted(tar_data.getnames()), ['bar', 'bar/foo', 'foo'] ) + + +class SSLAdapterTest(base.BaseTestCase): + def test_only_uses_tls(self): + ssl_context = ssladapter.urllib3.util.ssl_.create_urllib3_context() + + assert ssl_context.options & OP_NO_SSLv3 + assert ssl_context.options & OP_NO_SSLv2 + assert not ssl_context.options & OP_NO_TLSv1 |