mirror of https://github.com/docker/docker-py.git
Improves code style
This commit is contained in:
parent
844e41088e
commit
d8e0f5a66f
|
@ -156,71 +156,35 @@ def get_fake_inspect_image():
|
||||||
}
|
}
|
||||||
return status_code, response
|
return status_code, response
|
||||||
|
|
||||||
|
|
||||||
def get_fake_port():
|
def get_fake_port():
|
||||||
status_code = 200
|
status_code = 200
|
||||||
response = {'Args': [],
|
response = {
|
||||||
'Config': {'AttachStderr': True,
|
'HostConfig': {
|
||||||
'AttachStdin': False,
|
'Binds': None,
|
||||||
'AttachStdout': True,
|
|
||||||
'Cmd': ['yes'],
|
|
||||||
'CpuShares': 0,
|
|
||||||
'Dns': None,
|
|
||||||
'Domainname': '',
|
|
||||||
'Entrypoint': None,
|
|
||||||
'Env': None,
|
|
||||||
'ExposedPorts': {'1111': {}, '2222': {}},
|
|
||||||
'Hostname': 'a398832bc87e',
|
|
||||||
'Image': 'ubuntu',
|
|
||||||
'Memory': 0,
|
|
||||||
'MemorySwap': 0,
|
|
||||||
'NetworkDisabled': False,
|
|
||||||
'OpenStdin': False,
|
|
||||||
'PortSpecs': None,
|
|
||||||
'StdinOnce': False,
|
|
||||||
'Tty': False,
|
|
||||||
'User': '',
|
|
||||||
'Volumes': None,
|
|
||||||
'VolumesFrom': '',
|
|
||||||
'WorkingDir': ''},
|
|
||||||
'Created': '2013-12-14T17:41:13.976760086Z',
|
|
||||||
'Driver': 'aufs',
|
|
||||||
'HostConfig': {'Binds': None,
|
|
||||||
'ContainerIDFile': '',
|
'ContainerIDFile': '',
|
||||||
'Links': None,
|
'Links': None,
|
||||||
'LxcConf': None,
|
'LxcConf': None,
|
||||||
'PortBindings': {'1111': None,
|
'PortBindings': {
|
||||||
|
'1111': None,
|
||||||
'1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}],
|
'1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}],
|
||||||
'2222': None},
|
'2222': None
|
||||||
|
},
|
||||||
'Privileged': False,
|
'Privileged': False,
|
||||||
'PublishAllPorts': False},
|
'PublishAllPorts': False
|
||||||
'HostnamePath': '/var/lib/docker/containers/a398832bc87e15b220d710a98386493559df2448480fc9243e86ee5544eea767/hostname',
|
},
|
||||||
'HostsPath': '/var/lib/docker/containers/a398832bc87e15b220d710a98386493559df2448480fc9243e86ee5544eea767/hosts',
|
'NetworkSettings': {
|
||||||
'ID': 'a398832bc87e15b220d710a98386493559df2448480fc9243e86ee5544eea767',
|
'Bridge': 'docker0',
|
||||||
'Image': '8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c',
|
|
||||||
'Name': '/sad_tesla7',
|
|
||||||
'NetworkSettings': {'Bridge': 'docker0',
|
|
||||||
'Gateway': '172.17.42.1',
|
|
||||||
'IPAddress': '172.17.0.19',
|
|
||||||
'IPPrefixLen': 16,
|
|
||||||
'PortMapping': None,
|
'PortMapping': None,
|
||||||
'Ports': {'1111': None,
|
'Ports': {
|
||||||
|
'1111': None,
|
||||||
'1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}],
|
'1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}],
|
||||||
'2222': None}},
|
'2222': None}
|
||||||
'Path': 'yes',
|
}
|
||||||
'ResolvConfPath': '/var/lib/docker/containers/a398832bc87e15b220d710a98386493559df2448480fc9243e86ee5544eea767/resolv.conf',
|
}
|
||||||
'State': {'ExitCode': 0,
|
|
||||||
'FinishedAt': '0001-01-01T00:00:00Z',
|
|
||||||
'Ghost': False,
|
|
||||||
'Pid': 11703,
|
|
||||||
'Running': True,
|
|
||||||
'StartedAt': '2013-12-14T17:41:27.844076587Z'},
|
|
||||||
'SysInitPath': '/usr/bin/docker',
|
|
||||||
'Volumes': {},
|
|
||||||
'VolumesRW': {}}
|
|
||||||
|
|
||||||
|
|
||||||
return status_code, response
|
return status_code, response
|
||||||
|
|
||||||
|
|
||||||
def get_fake_insert_image():
|
def get_fake_insert_image():
|
||||||
status_code = 200
|
status_code = 200
|
||||||
response = {'StatusCode': 0}
|
response = {'StatusCode': 0}
|
||||||
|
|
|
@ -402,6 +402,7 @@ class TestKillWithSignal(BaseTestCase):
|
||||||
self.assertIn('Running', state)
|
self.assertIn('Running', state)
|
||||||
self.assertEqual(state['Running'], False, state)
|
self.assertEqual(state['Running'], False, state)
|
||||||
|
|
||||||
|
|
||||||
class TestPort(BaseTestCase):
|
class TestPort(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
|
|
||||||
|
@ -410,8 +411,9 @@ class TestPort(BaseTestCase):
|
||||||
2222: ('192.168.0.100', '4568')
|
2222: ('192.168.0.100', '4568')
|
||||||
}
|
}
|
||||||
|
|
||||||
container = self.client.create_container('busybox', ['sleep', '60'],
|
container = self.client.create_container(
|
||||||
ports=port_bindings.keys())
|
'busybox', ['sleep', '60'], ports=port_bindings.keys()
|
||||||
|
)
|
||||||
id = container['Id']
|
id = container['Id']
|
||||||
|
|
||||||
self.client.start(container, port_bindings=port_bindings)
|
self.client.start(container, port_bindings=port_bindings)
|
||||||
|
@ -428,6 +430,7 @@ class TestPort(BaseTestCase):
|
||||||
|
|
||||||
self.client.kill(id)
|
self.client.kill(id)
|
||||||
|
|
||||||
|
|
||||||
class TestRestart(BaseTestCase):
|
class TestRestart(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
container = self.client.create_container('busybox', ['sleep', '9999'])
|
container = self.client.create_container('busybox', ['sleep', '9999'])
|
||||||
|
|
|
@ -33,6 +33,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
|
||||||
def response(status_code=200, content='', headers=None, reason=None, elapsed=0,
|
def response(status_code=200, content='', headers=None, reason=None, elapsed=0,
|
||||||
request=None):
|
request=None):
|
||||||
res = requests.Response()
|
res = requests.Response()
|
||||||
|
|
Loading…
Reference in New Issue