diff options
Diffstat (limited to 'src/mailman_pgp/config')
| -rw-r--r-- | src/mailman_pgp/config/tests/test_validator.py | 13 | ||||
| -rw-r--r-- | src/mailman_pgp/config/validator.py | 4 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/mailman_pgp/config/tests/test_validator.py b/src/mailman_pgp/config/tests/test_validator.py index 15b0b62..d24dfc7 100644 --- a/src/mailman_pgp/config/tests/test_validator.py +++ b/src/mailman_pgp/config/tests/test_validator.py @@ -102,3 +102,16 @@ class TestValidator(TestCase): """) validator.validate(valid) self.assertRaises(ValueError, validator.validate, invalid) + + def test_none(self): + schema = """\ + [test] + test_option: + """ + validator = ConfigValidator(schema) + cfg = Config() + cfg.read_string("""\ + [test] + test_option: something + """) + self.assertRaises(ValueError, validator.validate, cfg) diff --git a/src/mailman_pgp/config/validator.py b/src/mailman_pgp/config/validator.py index debbf0a..1010663 100644 --- a/src/mailman_pgp/config/validator.py +++ b/src/mailman_pgp/config/validator.py @@ -51,14 +51,12 @@ class ConfigValidator: try: call = find_name(schema) except: - try: + if len(schema) != 0: def call(value): match = re.search(schema, value) if match is None: raise ValueError return match - except: - pass if call is None: raise ValueError |
