예제 #1
0
파일: misc.py 프로젝트: Nextdoor/kingpin
 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)