Beispiel #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)
Beispiel #2
0
 def _schemas(self):
     return SchemaProxy()
Beispiel #3
0
 def testGetSchemas(self):
     schema_id = 'http://json-schema.org/draft-04/schema#'
     sut = SchemaProxy()
     self.assertIn(schema_id, sut.get_schemas())
Beispiel #4
0
 def testSchemaShouldRaiseErrorForUnknownSchema(self):
     schema_id = 'https://example.com/schema#'
     sut = SchemaProxy()
     with self.assertRaises(SchemaNotFound):
         sut.get_schema(schema_id)
Beispiel #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#')
Beispiel #6
0
 def testValidateWithFailure(self):
     validator = Validator(self.PassThroughRewriter(), SchemaProxy())
     data = {}
     with self.assertRaises(ValidationError):
         validator.validate(data, SCHEMA)
Beispiel #7
0
 def testValidate(self):
     validator = Validator(self.PassThroughRewriter(), SchemaProxy())
     data = {
         'fruit_name': 'Apple',
     }
     validator.validate(data, SCHEMA)