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