Use split_port for ports format check
Rather than implement the logic a second time, use docker-py split_port function to test if the ports is valid. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
2e428f94ca
commit
df74b131ff
3 changed files with 12 additions and 29 deletions
|
|
@ -76,7 +76,7 @@ class ConfigTest(unittest.TestCase):
|
|||
|
||||
def test_config_invalid_ports_format_validation(self):
|
||||
with self.assertRaises(ConfigurationError):
|
||||
for invalid_ports in [{"1": "8000"}, "whatport"]:
|
||||
for invalid_ports in [{"1": "8000"}, "whatport", "625", "8000:8050"]:
|
||||
config.load(
|
||||
config.ConfigDetails(
|
||||
{'web': {'image': 'busybox', 'ports': invalid_ports}},
|
||||
|
|
@ -86,7 +86,7 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_config_valid_ports_format_validation(self):
|
||||
valid_ports = [["8000", "9000"], "625", "8000:8050", ["8000/8050"]]
|
||||
valid_ports = [["8000", "9000"], ["8000/8050"], ["8000"]]
|
||||
for ports in valid_ports:
|
||||
config.load(
|
||||
config.ConfigDetails(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue