Skip to content

Commit a44d65b

Browse files
authored
Merge pull request #1187 from bfirsh/fix-broken-mac-address-unit-test
Fix unit test which doesn't do anything
2 parents 08da5bf + 0cdf737 commit a44d65b

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

tests/unit/container_test.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,18 @@ def test_create_container_with_port_binds(self):
751751
)
752752

753753
def test_create_container_with_mac_address(self):
754-
mac_address_expected = "02:42:ac:11:00:0a"
754+
expected = "02:42:ac:11:00:0a"
755755

756-
container = self.client.create_container(
757-
'busybox', ['sleep', '60'], mac_address=mac_address_expected)
756+
self.client.create_container(
757+
'busybox',
758+
['sleep', '60'],
759+
mac_address=expected
760+
)
758761

759-
res = self.client.inspect_container(container['Id'])
760-
self.assertEqual(mac_address_expected,
761-
res['NetworkSettings']['MacAddress'])
762+
args = fake_request.call_args
763+
self.assertEqual(args[0][1], url_prefix + 'containers/create')
764+
data = json.loads(args[1]['data'])
765+
assert data['MacAddress'] == expected
762766

763767
def test_create_container_with_links(self):
764768
link_path = 'path'

tests/unit/fake_api.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -169,35 +169,6 @@ def get_fake_inspect_image():
169169
return status_code, response
170170

171171

172-
def get_fake_port():
173-
status_code = 200
174-
response = {
175-
'HostConfig': {
176-
'Binds': None,
177-
'ContainerIDFile': '',
178-
'Links': None,
179-
'LxcConf': None,
180-
'PortBindings': {
181-
'1111': None,
182-
'1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}],
183-
'2222': None
184-
},
185-
'Privileged': False,
186-
'PublishAllPorts': False
187-
},
188-
'NetworkSettings': {
189-
'Bridge': 'docker0',
190-
'PortMapping': None,
191-
'Ports': {
192-
'1111': None,
193-
'1111/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '4567'}],
194-
'2222': None},
195-
'MacAddress': '02:42:ac:11:00:0a'
196-
}
197-
}
198-
return status_code, response
199-
200-
201172
def get_fake_insert_image():
202173
status_code = 200
203174
response = {'StatusCode': 0}
@@ -495,8 +466,6 @@ def post_fake_update_container():
495466
post_fake_pause_container,
496467
'{1}/{0}/containers/3cc2351ab11b/unpause'.format(CURRENT_VERSION, prefix):
497468
post_fake_unpause_container,
498-
'{1}/{0}/containers/3cc2351ab11b/json'.format(CURRENT_VERSION, prefix):
499-
get_fake_port,
500469
'{1}/{0}/containers/3cc2351ab11b/restart'.format(CURRENT_VERSION, prefix):
501470
post_fake_restart_container,
502471
'{1}/{0}/containers/3cc2351ab11b'.format(CURRENT_VERSION, prefix):

0 commit comments

Comments
 (0)