Skip to content

Commit

Permalink
WIP Adds test for parse_env_file
Browse files Browse the repository at this point in the history
  • Loading branch information
vpetersson committed Jul 29, 2015
1 parent 4448ae7 commit e1c719e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/utils_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import os.path
import unittest
import mock

from docker.client import Client
from docker.errors import DockerException
from docker.utils import (
parse_repository_tag, parse_host, convert_filters, kwargs_from_env,
create_host_config, Ulimit, LogConfig, parse_bytes
create_host_config, Ulimit, LogConfig, parse_bytes, parse_env_file
)
from docker.utils.ports import build_port_bindings, split_port
from docker.auth import resolve_repository_name, resolve_authconfig
Expand Down Expand Up @@ -95,6 +96,14 @@ def test_kwargs_from_env(self):
except TypeError as e:
self.fail(e)

def test_parse_env_file_proper(self):
with mock.patch('os.path.isfile', return_value=True):
mock_env_file = 'USER=jdoe\nPASS=secret'
with mock.patch('{}.open'.format(__name__), mock.mock_open(read_data=mock_env_file)):
get_parse_env_file = parse_env_file('foobar')
self.assertEqual(get_parse_env_file, ['USER=jdoe', 'PASS=secret'])


def test_convert_filters(self):
tests = [
({'dangling': True}, '{"dangling": ["true"]}'),
Expand Down

0 comments on commit e1c719e

Please sign in to comment.