Kaydet (Commit) 72446b47 authored tarafından Jan Losinski's avatar Jan Losinski Kaydeden (comit) Aanand Prasad

Add unittest for the Tmpfs Hostconfig option

Signed-off-by: 's avatarJan Losinski <losinski@wh2.tu-dresden.de>
üst 9e940708
......@@ -1016,6 +1016,62 @@ class CreateContainerTest(DockerClientTest):
}
}}'''))
def test_create_container_with_tmpfs_list(self):
self.client.create_container(
'busybox', 'true', host_config=self.client.create_host_config(
tmpfs=[
"/tmp",
"/mnt:size=3G,uid=100"
]
)
)
args = fake_request.call_args
self.assertEqual(args[0][1], url_prefix +
'containers/create')
expected_payload = self.base_create_payload()
expected_payload['HostConfig'] = self.client.create_host_config()
expected_payload['HostConfig']['Tmpfs'] = {
"/tmp": "",
"/mnt": "size=3G,uid=100"
}
self.assertEqual(json.loads(args[1]['data']), expected_payload)
self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'})
self.assertEqual(
args[1]['timeout'],
DEFAULT_TIMEOUT_SECONDS
)
def test_create_container_with_tmpfs_dict(self):
self.client.create_container(
'busybox', 'true', host_config=self.client.create_host_config(
tmpfs={
"/tmp": "",
"/mnt": "size=3G,uid=100"
}
)
)
args = fake_request.call_args
self.assertEqual(args[0][1], url_prefix +
'containers/create')
expected_payload = self.base_create_payload()
expected_payload['HostConfig'] = self.client.create_host_config()
expected_payload['HostConfig']['Tmpfs'] = {
"/tmp": "",
"/mnt": "size=3G,uid=100"
}
self.assertEqual(json.loads(args[1]['data']), expected_payload)
self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'})
self.assertEqual(
args[1]['timeout'],
DEFAULT_TIMEOUT_SECONDS
)
class ContainerTest(DockerClientTest):
def test_list_containers(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment