-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathtest_config.py
More file actions
47 lines (38 loc) · 1.39 KB
/
test_config.py
File metadata and controls
47 lines (38 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import ssl
import docker.client
from docker.constants import DEFAULT_TIMEOUT_SECONDS
import deck_chores.config
cfg, generate_config = deck_chores.config.cfg, deck_chores.config.generate_config
def test_default_config(monkeypatch):
def docker_api_version(self):
return '1.37'
def every_file_exists(*args, **kwargs):
return True
monkeypatch.setenv('DEBUG', '0')
monkeypatch.setattr(deck_chores.config, 'exists', every_file_exists)
monkeypatch.setattr(
docker.client.APIClient, '_retrieve_server_version', docker_api_version
)
generate_config()
result = cfg.__dict__.copy()
assert isinstance(result.pop('client'), docker.client.DockerClient)
assert result == {
'assert_hostname': False,
'client_timeout': DEFAULT_TIMEOUT_SECONDS,
'docker_host': 'unix://var/run/docker.sock',
'debug': False,
'default_max': 1,
'default_flags': ('image', 'service'),
'exit_on_unexpected_container_states': False,
'job_executor_pool_size': 10,
'job_name_regex': '[a-z0-9-]+',
'label_ns': 'deck-chores.',
'logformat': '{asctime}|{levelname:8}|{message}',
'service_identifiers': (
'com.docker.compose.project',
'com.docker.compose.service',
),
'ssl_version': ssl.PROTOCOL_TLS,
'stderr_level': 0,
'timezone': 'UTC',
}