mirror of https://github.com/docker/docker-py.git
Merge bc5bcdade5
into db7f8b8bb6
This commit is contained in:
commit
329c60262b
|
@ -560,11 +560,9 @@ class EndpointSpec(dict):
|
||||||
|
|
||||||
|
|
||||||
def convert_service_ports(ports):
|
def convert_service_ports(ports):
|
||||||
if isinstance(ports, list):
|
|
||||||
return ports
|
|
||||||
if not isinstance(ports, dict):
|
if not isinstance(ports, dict):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
'Invalid type for ports, expected dict or list'
|
'Invalid type for ports, expected dict'
|
||||||
)
|
)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
|
@ -491,3 +491,9 @@ class ServicePortsTest(unittest.TestCase):
|
||||||
} in converted_ports
|
} in converted_ports
|
||||||
|
|
||||||
assert len(converted_ports) == 3
|
assert len(converted_ports) == 3
|
||||||
|
|
||||||
|
def test_convert_service_ports_wrong_ports_type(self):
|
||||||
|
ports = 'ports_as_string'
|
||||||
|
|
||||||
|
with pytest.raises(TypeError):
|
||||||
|
convert_service_ports(ports)
|
||||||
|
|
Loading…
Reference in New Issue