Fix ports validation test

We were essentially only testing that *at least one* of the invalid
values fails the validation check, rather than that *all* of them fail.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-11-26 15:06:30 +00:00
parent 7b893164a4
commit b85bfce65e
1 changed files with 2 additions and 3 deletions

View File

@ -264,9 +264,8 @@ class ConfigTest(unittest.TestCase):
assert services[0]['name'] == valid_name
def test_config_invalid_ports_format_validation(self):
expected_error_msg = "Service 'web' configuration key 'ports' contains an invalid type"
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
for invalid_ports in [{"1": "8000"}, False, 0, "8000", 8000, ["8000", "8000"]]:
for invalid_ports in [{"1": "8000"}, False, 0, "8000", 8000, ["8000", "8000"]]:
with pytest.raises(ConfigurationError):
config.load(
build_config_details(
{'web': {'image': 'busybox', 'ports': invalid_ports}},