Kaydet (Commit) a710fbf6 authored tarafından Joffrey F's avatar Joffrey F

Unit test for Client.update_container method

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst 6f6d0890
......@@ -1407,3 +1407,21 @@ class ContainerTest(DockerClientTest):
params={'ps_args': 'waux'},
timeout=DEFAULT_TIMEOUT_SECONDS
)
@requires_api_version('1.22')
def test_container_update(self):
self.client.update_container(
fake_api.FAKE_CONTAINER_ID, mem_limit='2k', cpu_shares=124,
blkio_weight=345
)
args = fake_request.call_args
self.assertEqual(
args[0][1], url_prefix + 'containers/3cc2351ab11b/update'
)
self.assertEqual(
json.loads(args[1]['data']),
{'Memory': 2 * 1024, 'CpuShares': 124, 'BlkioWeight': 345}
)
self.assertEqual(
args[1]['headers']['Content-Type'], 'application/json'
)
......@@ -441,6 +441,11 @@ def get_fake_volume():
def fake_remove_volume():
return 204, None
def post_fake_update_container():
return 200, {'Warnings': []}
# Maps real api url to fake response callback
prefix = 'http+docker://localunixsocket'
fake_responses = {
......@@ -478,6 +483,8 @@ fake_responses = {
get_fake_diff,
'{1}/{0}/containers/3cc2351ab11b/export'.format(CURRENT_VERSION, prefix):
get_fake_export,
'{1}/{0}/containers/3cc2351ab11b/update'.format(CURRENT_VERSION, prefix):
post_fake_update_container,
'{1}/{0}/containers/3cc2351ab11b/exec'.format(CURRENT_VERSION, prefix):
post_fake_exec_create,
'{1}/{0}/exec/d5d177f121dc/start'.format(CURRENT_VERSION, prefix):
......
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