def test_schema_validate(self): s = Schema(**SCHEMA_1) # Duplicate unique attribute 'name' m = [{ 'type': 'listener', 'name': 'x' }, { 'type': 'listener', 'name': 'x' }] self.assertRaises(ValidationError, s.validate_all, m) # Duplicate singleton entity 'container' m = [{ 'type': 'container', 'name': 'x' }, { 'type': 'container', 'name': 'y' }] self.assertRaises(ValidationError, s.validate_all, m) # Valid model m = [{ 'type': 'container', 'name': 'x' }, { 'type': 'listener', 'name': 'y' }] s.validate_all(m)
def test_schema_validate(self): s = Schema(**SCHEMA_1) # Duplicate unique attribute 'name' m = [{"type": "listener", "name": "x"}, {"type": "listener", "name": "x"}] self.assertRaises(ValidationError, s.validate_all, m) # Duplicate singleton entity 'container' m = [{"type": "container", "name": "x"}, {"type": "container", "name": "y"}] self.assertRaises(ValidationError, s.validate_all, m) # Valid model m = [{"type": "container", "name": "x"}, {"type": "listener", "name": "y"}] s.validate_all(m)
def test_schema_validate(self): s = Schema(**SCHEMA_1) # Duplicate unique attribute 'name' m = [{'type': 'listener', 'name':'x'}, {'type': 'listener', 'name':'x'}] self.assertRaises(ValidationError, s.validate_all, m) # Duplicate singleton entity 'container' m = [{'type': 'container', 'name':'x'}, {'type': 'container', 'name':'y'}] self.assertRaises(ValidationError, s.validate_all, m) # Valid model m = [{'type': 'container', 'name':'x'}, {'type': 'listener', 'name':'y'}] s.validate_all(m)