Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 def test_validate_with_invalid_array(self):
     json = [{'garbage': 'json'}]
     with self.assertRaises(exceptions.InvalidScript):
         schema.validate(json)
Пример #4
0
 def test_validate_with_invalid_json(self):
     json = {'this': 'is', 'invalid': 'ok'}
     with self.assertRaises(exceptions.InvalidScript):
         schema.validate(json)
Пример #5
0
 def test_validate_with_array_syntax(self):
     json = [{'actor': 'some actor'}]
     schema.validate(json)
Пример #6
0
 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)
Пример #7
0
 def test_validate_with_invalid_array(self):
     json = [{'garbage': 'json'}]
     with self.assertRaises(exceptions.InvalidScript):
         schema.validate(json)
Пример #8
0
 def test_validate_with_array_syntax(self):
     json = [{'actor': 'some actor'}]
     schema.validate(json)
Пример #9
0
 def test_validate_with_invalid_json(self):
     json = {'this': 'is', 'invalid': 'ok'}
     with self.assertRaises(exceptions.InvalidScript):
         schema.validate(json)
Пример #10
0
 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)