mirror of https://github.com/docker/docker-py.git
convert_service_ports takes only a dict as param
Signed-off-by: billou <nabil.benyoussef@gmail.com>
This commit is contained in:
parent
a3652028b1
commit
bc5bcdade5
|
|
@ -560,11 +560,9 @@ class EndpointSpec(dict):
|
|||
|
||||
|
||||
def convert_service_ports(ports):
|
||||
if isinstance(ports, list):
|
||||
return ports
|
||||
if not isinstance(ports, dict):
|
||||
raise TypeError(
|
||||
'Invalid type for ports, expected dict or list'
|
||||
'Invalid type for ports, expected dict'
|
||||
)
|
||||
|
||||
result = []
|
||||
|
|
|
|||
|
|
@ -491,3 +491,9 @@ class ServicePortsTest(unittest.TestCase):
|
|||
} in converted_ports
|
||||
|
||||
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