def test_generate_config_volumes(): redis = flexmock() redis.should_receive('hgetall').and_return([]) fake_inject({txredisapi.Connection: redis}) s = Service() s.name = 'my_service' s.volumes = [{ 'local': '/base/path/foo1', 'remote': '/bar1' }, { 'local': '/base/path/foo2', 'remote': '/bar2' }, { 'local': '/base/path/foo3', 'remote': '/bar3' }] config = yield s._generate_config('foo') assert config == { "Hostname": 'my_service', "Image": 'foo', # Volumes are not passed as of Docker 1.6 version # "Volumes": { # "/bar1": {}, # "/bar2": {}, # "/bar3": {}, # } }
def test_generate_config_volumes(): redis = flexmock() redis.should_receive('hgetall').and_return([]) fake_inject({ txredisapi.Connection: redis }) s = Service() s.name = 'my_service' s.volumes = [ {'local': '/base/path/foo1', 'remote': '/bar1'}, {'local': '/base/path/foo2', 'remote': '/bar2'}, {'local': '/base/path/foo3', 'remote': '/bar3'} ] config = yield s._generate_config('foo') assert config == { "Hostname": 'my_service', "Image": 'foo', # Volumes are not passed as of Docker 1.6 version # "Volumes": { # "/bar1": {}, # "/bar2": {}, # "/bar3": {}, # } }
def test_generate_config(): redis = flexmock() redis.should_receive('hgetall').and_return([]) fake_inject({txredisapi.Connection: redis}) s = Service() s.name = 'my_service' config = yield s._generate_config('foo') assert config == {"Hostname": 'my_service', "Image": 'foo'}
def test_generate_config_env(): redis = flexmock() redis.should_receive('hgetall').and_return({}) fake_inject({txredisapi.Connection: redis}) s = Service() s.name = 'my_service' s.env = {'FOO': 'bar', 'BAZ': 'foo'} config = yield s._generate_config('foo') assert config == { "Hostname": 'my_service', "Image": 'foo', "Env": ['FOO=bar', 'BAZ=foo'] }
def test_generate_config(): redis = flexmock() redis.should_receive('hgetall').and_return([]) fake_inject({ txredisapi.Connection: redis }) s = Service() s.name = 'my_service' config = yield s._generate_config('foo') assert config == { "Hostname": 'my_service', "Image": 'foo' }
def test_generate_config_env(): redis = flexmock() redis.should_receive('hgetall').and_return({}) fake_inject({ txredisapi.Connection: redis }) s = Service() s.name = 'my_service' s.env = {'FOO': 'bar', 'BAZ': 'foo'} config = yield s._generate_config('foo') assert config == { "Hostname": 'my_service', "Image": 'foo', "Env": ['FOO=bar', 'BAZ=foo'] }