diff options
author | Ben Firshman <ben@firshman.co.uk> | 2016-09-07 10:47:06 +0200 |
---|---|---|
committer | Ben Firshman <ben@firshman.co.uk> | 2016-09-07 11:40:19 +0200 |
commit | 0cdf7376253499923746f160106a757611988341 (patch) | |
tree | b85d32d1ee77ca958e29aeb061bf879bac9dbbdd | |
parent | 08da5bfdfcf3b62a9f0b27cb4090d4cf04909c67 (diff) | |
download | docker-py-0cdf7376253499923746f160106a757611988341.tar.gz |
Fix unit test which doesn't do anything
It also overrode the fake API inspect endpoint with a broken
response.
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
-rw-r--r-- | tests/unit/container_test.py | 16 | ||||
-rw-r--r-- | tests/unit/fake_api.py | 31 |
2 files changed, 10 insertions, 37 deletions
diff --git a/tests/unit/container_test.py b/tests/unit/container_test.py index 3cea42f..8871b85 100644 --- a/tests/unit/container_test.py +++ b/tests/unit/container_test.py @@ -751,14 +751,18 @@ class CreateContainerTest(DockerClientTest): ) def test_create_container_with_mac_address(self): - mac_address_expected = "02:42:ac:11:00:0a" + expected = "02:42:ac:11:00:0a" - container = self.client.create_container( - 'busybox', ['sleep', '60'], mac_address=mac_address_expected) + self.client.create_container( + 'busybox', + ['sleep', '60'], + mac_address=expected + ) - res = self.client.inspect_container(container['Id']) - self.assertEqual(mac_address_expected, - res['NetworkSettings']['MacAddress']) + args = fake_request.call_args + self.assertEqual(args[0][1], url_prefix + 'containers/create') + data = json.loads(args[1]['data']) + assert data['MacAddress'] == expected def test_create_container_with_links(self): link_path = 'path' diff --git a/tests/unit/fake_api.py b/tests/unit/fake_api.py index 54d5566..1e9d318 100644 --- a/tests/unit/fake_api.py +++ b/tests/unit/fake_api.py @@ -169,35 +169,6 @@ def get_fake_inspect_image(): return status_code, response -def get_fake_port(): - status_code = 200 - response = { - 'HostConfig': { - 'Binds': None, - 'ContainerIDFile': '', - 'Links': None, - 'LxcConf': None, - 'PortBindings': { - '1111': None, - '1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}], - '2222': None - }, - 'Privileged': False, - 'PublishAllPorts': False - }, - 'NetworkSettings': { - 'Bridge': 'docker0', - 'PortMapping': None, - 'Ports': { - '1111': None, - '1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}], - '2222': None}, - 'MacAddress': '02:42:ac:11:00:0a' - } - } - return status_code, response - - def get_fake_insert_image(): status_code = 200 response = {'StatusCode': 0} @@ -495,8 +466,6 @@ fake_responses = { post_fake_pause_container, '{1}/{0}/containers/3cc2351ab11b/unpause'.format(CURRENT_VERSION, prefix): post_fake_unpause_container, - '{1}/{0}/containers/3cc2351ab11b/json'.format(CURRENT_VERSION, prefix): - get_fake_port, '{1}/{0}/containers/3cc2351ab11b/restart'.format(CURRENT_VERSION, prefix): post_fake_restart_container, '{1}/{0}/containers/3cc2351ab11b'.format(CURRENT_VERSION, prefix): |