Skip to content

Commit 1a7ac70

Browse files
committed
CR fix
1 parent f28b07d commit 1a7ac70

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/tests/test_core_ports.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ def test_docker_container_with_bind_ports(container_port: Union[str, int], host_
2525
container.with_bind_ports(container_port, host_port)
2626
container.start()
2727

28+
# prepare to inspect container
2829
container_id = container._container.id
2930
client = container._container.client
3031

31-
if isinstance(container_port, int):
32-
container_port = str(container_port)
33-
if isinstance(host_port, int):
34-
host_port = str(host_port)
35-
if not host_port:
36-
host_port = ""
32+
# assemble expected output to compare to container API
33+
container_port = str(container_port)
34+
host_port = str(host_port or "")
3735

3836
# if the port protocol is not specified, it will default to tcp
3937
if "/" not in container_port:
4038
container_port += "/tcp"
4139

42-
excepted = {container_port: [{"HostIp": "", "HostPort": host_port}]}
43-
assert client.containers.get(container_id).attrs["HostConfig"]["PortBindings"] == excepted
40+
expected = {container_port: [{"HostIp": "", "HostPort": host_port}]}
41+
42+
# compare PortBindings to expected output
43+
assert client.containers.get(container_id).attrs["HostConfig"]["PortBindings"] == expected
4444
container.stop()
4545

4646

0 commit comments

Comments
 (0)