Ejemplo n.º 1
0
def create_dynamic_schema(objects_json, urls_json):
    schema = Schema("./tests/files/empty_schema.json")
    schema.create_objects(objects_json)
    schema.create_apis(urls_json)
    schema.validate_apis_and_objects()
    schema.add_relationship_objects()
    return schema
Ejemplo n.º 2
0
def create_dynamic_schema(objects_json, urls_json):
    schema = Schema("./tests/files/empty_schema.json")
    schema.create_objects(objects_json)
    schema.create_apis(urls_json)
    schema.validate_apis_and_objects()
    schema.add_relationship_objects()
    return schema
Ejemplo n.º 3
0
 def test_create_apis(self):
     schema = Schema("./tests/files/empty_schema.json")
     self.assertEqual(schema.urls, [])
     schema.create_apis([
         {
             "url": "posts/",
             "get": {
                 "#meta": "oauth2,optional",
                 "response": {
                     "200+": "$postResponse"
                 }
             }
         },
         {
             "url": "follows/:id/",
             "delete": {
                 "#meta": "oauth2"
             }
         }
     ])
     self.assertEqual(len(schema.urls), 2)
     self.assertEqual(schema.urls[0].url_path, "posts/")