def _check_schema(self, config): # Run the dict through our schema validator quickly self.log.debug('Validating schema for %s' % self.option('macro')) try: schema.validate(config) except kingpin_exceptions.InvalidScript as e: self.log.critical('Invalid Schema.') raise exceptions.UnrecoverableActorFailure(e)
def test_validate_with_invalid_array(self): json = [{'garbage': 'json'}] with self.assertRaises(exceptions.InvalidScript): schema.validate(json)
def test_validate_with_invalid_json(self): json = {'this': 'is', 'invalid': 'ok'} with self.assertRaises(exceptions.InvalidScript): schema.validate(json)
def test_validate_with_array_syntax(self): json = [{'actor': 'some actor'}] schema.validate(json)
def test_validate_with_complex_json(self): json = demjson.decode(open('%s/complex.json' % self.examples).read()) ret = schema.validate(json) self.assertEquals(None, ret)
def test_validate_with_complex_json(self): json = demjson.decode(open('%s/complex.json' % self.examples).read()) ret = schema.validate(json) self.assertEqual(None, ret)