summaryrefslogtreecommitdiff
path: root/tests/unit/cli/command_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/cli/command_test.py')
-rw-r--r--tests/unit/cli/command_test.py44
1 files changed, 26 insertions, 18 deletions
diff --git a/tests/unit/cli/command_test.py b/tests/unit/cli/command_test.py
index 50fc84e1..3a9844c4 100644
--- a/tests/unit/cli/command_test.py
+++ b/tests/unit/cli/command_test.py
@@ -1,13 +1,13 @@
+# ~*~ encoding: utf-8 ~*~
from __future__ import absolute_import
from __future__ import unicode_literals
import os
-import ssl
import pytest
+import six
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
@@ -45,24 +45,32 @@ class TestGetConfigPathFromOptions(object):
'.', {}, environment
) == ['one.yml', 'two.yml']
+ def test_multiple_path_from_env_custom_separator(self):
+ with mock.patch.dict(os.environ):
+ os.environ['COMPOSE_PATH_SEPARATOR'] = '^'
+ os.environ['COMPOSE_FILE'] = 'c:\\one.yml^.\\semi;colon.yml'
+ environment = Environment.from_env_file('.')
+ assert get_config_path_from_options(
+ '.', {}, environment
+ ) == ['c:\\one.yml', '.\\semi;colon.yml']
+
def test_no_path(self):
environment = Environment.from_env_file('.')
assert not get_config_path_from_options('.', {}, environment)
+ def test_unicode_path_from_options(self):
+ paths = [b'\xe5\xb0\xb1\xe5\x90\x83\xe9\xa5\xad/docker-compose.yml']
+ opts = {'--file': paths}
+ environment = Environment.from_env_file('.')
+ assert get_config_path_from_options(
+ '.', opts, environment
+ ) == ['就吃饭/docker-compose.yml']
-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
+ @pytest.mark.skipif(six.PY3, reason='Env values in Python 3 are already Unicode')
+ def test_unicode_path_from_env(self):
+ with mock.patch.dict(os.environ):
+ os.environ['COMPOSE_FILE'] = b'\xe5\xb0\xb1\xe5\x90\x83\xe9\xa5\xad/docker-compose.yml'
+ environment = Environment.from_env_file('.')
+ assert get_config_path_from_options(
+ '.', {}, environment
+ ) == ['就吃饭/docker-compose.yml']