mirror of https://github.com/docker/docker-py.git
Unit test for Client.update_container method
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
6f6d0890a4
commit
a710fbf60a
|
|
@ -1407,3 +1407,21 @@ class ContainerTest(DockerClientTest):
|
||||||
params={'ps_args': 'waux'},
|
params={'ps_args': 'waux'},
|
||||||
timeout=DEFAULT_TIMEOUT_SECONDS
|
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():
|
def fake_remove_volume():
|
||||||
return 204, None
|
return 204, None
|
||||||
|
|
||||||
|
|
||||||
|
def post_fake_update_container():
|
||||||
|
return 200, {'Warnings': []}
|
||||||
|
|
||||||
|
|
||||||
# Maps real api url to fake response callback
|
# Maps real api url to fake response callback
|
||||||
prefix = 'http+docker://localunixsocket'
|
prefix = 'http+docker://localunixsocket'
|
||||||
fake_responses = {
|
fake_responses = {
|
||||||
|
|
@ -478,6 +483,8 @@ fake_responses = {
|
||||||
get_fake_diff,
|
get_fake_diff,
|
||||||
'{1}/{0}/containers/3cc2351ab11b/export'.format(CURRENT_VERSION, prefix):
|
'{1}/{0}/containers/3cc2351ab11b/export'.format(CURRENT_VERSION, prefix):
|
||||||
get_fake_export,
|
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):
|
'{1}/{0}/containers/3cc2351ab11b/exec'.format(CURRENT_VERSION, prefix):
|
||||||
post_fake_exec_create,
|
post_fake_exec_create,
|
||||||
'{1}/{0}/exec/d5d177f121dc/start'.format(CURRENT_VERSION, prefix):
|
'{1}/{0}/exec/d5d177f121dc/start'.format(CURRENT_VERSION, prefix):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue