12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- from synapse.config import ConfigError
- from synapse.config._util import validate_config
- from tests.unittest import TestCase
- class ValidateConfigTestCase(TestCase):
- """Test cases for synapse.config._util.validate_config"""
- def test_bad_object_in_array(self):
- """malformed objects within an array should be validated correctly"""
-
-
-
-
-
-
-
-
-
-
-
- schema = {
- "type": "object",
- "properties": {
- "array_of_objs": {
- "type": "array",
- "items": {"type": "object", "required": ["r"]},
- },
- },
- }
- with self.assertRaises(ConfigError) as c:
- validate_config(schema, {"array_of_objs": [{}]}, ("base",))
- self.assertEqual(c.exception.path, ["base", "array_of_objs", "<item 0>"])
|