Ejemplo n.º 1
0
 def testSchemaShouldFindExactMatch(self):
     schema_id = 'http://json-schema.org/draft-04/schema#'
     sut = SchemaProxy()
     self.assertEquals(sut.get_schema(schema_id)['id'], schema_id)
Ejemplo n.º 2
0
 def _schemas(self):
     return SchemaProxy()
Ejemplo n.º 3
0
 def testGetSchemas(self):
     schema_id = 'http://json-schema.org/draft-04/schema#'
     sut = SchemaProxy()
     self.assertIn(schema_id, sut.get_schemas())
Ejemplo n.º 4
0
 def testSchemaShouldRaiseErrorForUnknownSchema(self):
     schema_id = 'https://example.com/schema#'
     sut = SchemaProxy()
     with self.assertRaises(SchemaNotFound):
         sut.get_schema(schema_id)
Ejemplo n.º 5
0
 def testSchemaShouldFindMatchWithRemovedFragment(self):
     schema_id = 'http://json-schema.org/draft-04/schema'
     sut = SchemaProxy()
     self.assertEquals(sut.get_schema(schema_id)['id'],
                       'http://json-schema.org/draft-04/schema#')
Ejemplo n.º 6
0
 def testValidateWithFailure(self):
     validator = Validator(self.PassThroughRewriter(), SchemaProxy())
     data = {}
     with self.assertRaises(ValidationError):
         validator.validate(data, SCHEMA)
Ejemplo n.º 7
0
 def testValidate(self):
     validator = Validator(self.PassThroughRewriter(), SchemaProxy())
     data = {
         'fruit_name': 'Apple',
     }
     validator.validate(data, SCHEMA)