Prechádzať zdrojové kódy

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 <[email protected]>
Aanand Prasad 10 rokov pred
rodič
commit
b85bfce65e
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      tests/unit/config/config_test.py

+ 2 - 3
tests/unit/config/config_test.py

@@ -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}},