mirror of
https://github.com/docker/compose.git
synced 2026-10-20 19:02:47 +00:00
Recognize COMPOSE_TLS_VERSION env var in tls_config_from_options
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
402b0157d4
commit
f55c9d4201
4 changed files with 53 additions and 41 deletions
|
|
@ -2,12 +2,10 @@ from __future__ import absolute_import
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import ssl
|
||||
|
||||
import pytest
|
||||
|
||||
from compose.cli.command import get_config_path_from_options
|
||||
from compose.cli.command import get_tls_version
|
||||
from compose.config.environment import Environment
|
||||
from compose.const import IS_WINDOWS_PLATFORM
|
||||
from tests import mock
|
||||
|
|
@ -57,21 +55,3 @@ class TestGetConfigPathFromOptions(object):
|
|||
def test_no_path(self):
|
||||
environment = Environment.from_env_file('.')
|
||||
assert not get_config_path_from_options('.', {}, environment)
|
||||
|
||||
|
||||
class TestGetTlsVersion(object):
|
||||
def test_get_tls_version_default(self):
|
||||
environment = {}
|
||||
assert get_tls_version(environment) is None
|
||||
|
||||
@pytest.mark.skipif(not hasattr(ssl, 'PROTOCOL_TLSv1_2'), reason='TLS v1.2 unsupported')
|
||||
def test_get_tls_version_upgrade(self):
|
||||
environment = {'COMPOSE_TLS_VERSION': 'TLSv1_2'}
|
||||
assert get_tls_version(environment) == ssl.PROTOCOL_TLSv1_2
|
||||
|
||||
def test_get_tls_version_unavailable(self):
|
||||
environment = {'COMPOSE_TLS_VERSION': 'TLSv5_5'}
|
||||
with mock.patch('compose.cli.command.log') as mock_log:
|
||||
tls_version = get_tls_version(environment)
|
||||
mock_log.warn.assert_called_once_with(mock.ANY)
|
||||
assert tls_version is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue