fixed and tested subschema promotions for beat processing
This commit is contained in:
152
append_test.py
Normal file
152
append_test.py
Normal file
@ -0,0 +1,152 @@
|
||||
import json
|
||||
|
||||
path = "fixtures/database.json"
|
||||
|
||||
with open(path, "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
new_test = {
|
||||
"description": "Schema Promotion Accuracy Test - -- One Database to Rule Them All --",
|
||||
"database": {
|
||||
"puncs": [],
|
||||
"enums": [],
|
||||
"relations": [],
|
||||
"types": [
|
||||
{
|
||||
"id": "t1",
|
||||
"type": "type",
|
||||
"name": "person",
|
||||
"module": "core",
|
||||
"source": "person",
|
||||
"hierarchy": ["person"],
|
||||
"variations": ["person", "student"],
|
||||
"schemas": {
|
||||
"full.person": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {"type": "string"},
|
||||
"name": {"type": "string"},
|
||||
"email": {
|
||||
"$family": "email_address"
|
||||
},
|
||||
"generic_bubble": {
|
||||
"type": "some_bubble"
|
||||
},
|
||||
"ad_hoc_bubble": {
|
||||
"type": "some_bubble",
|
||||
"properties": {
|
||||
"extra_inline_feature": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"}
|
||||
},
|
||||
"standard_relations": {
|
||||
"type": "array",
|
||||
"items": {"type": "contact"}
|
||||
},
|
||||
"extended_relations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "contact",
|
||||
"properties": {
|
||||
"target": {"type": "email_address"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"student.person": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {"type": "string"},
|
||||
"kind": {"type": "string"},
|
||||
"school": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "t2",
|
||||
"type": "type",
|
||||
"name": "email_address",
|
||||
"module": "core",
|
||||
"source": "email_address",
|
||||
"hierarchy": ["email_address"],
|
||||
"variations": ["email_address"],
|
||||
"schemas": {
|
||||
"light.email_address": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "t3",
|
||||
"type": "type",
|
||||
"name": "contact",
|
||||
"module": "core",
|
||||
"source": "contact",
|
||||
"hierarchy": ["contact"],
|
||||
"variations": ["contact"],
|
||||
"schemas": {
|
||||
"full.contact": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "t4",
|
||||
"type": "type",
|
||||
"name": "some_bubble",
|
||||
"module": "core",
|
||||
"source": "some_bubble",
|
||||
"hierarchy": ["some_bubble"],
|
||||
"variations": ["some_bubble"],
|
||||
"schemas": {
|
||||
"some_bubble": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bubble_prop": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "Assert exact topological schema promotion paths",
|
||||
"action": "compile",
|
||||
"expect": {
|
||||
"success": True,
|
||||
"schemas": [
|
||||
"ad_hoc_bubble",
|
||||
"email_address",
|
||||
"extended_relations",
|
||||
"extended_relations/target",
|
||||
"full.contact",
|
||||
"full.person",
|
||||
"full.person/ad_hoc_bubble",
|
||||
"full.person/extended_relations",
|
||||
"full.person/extended_relations/target",
|
||||
"light.email_address",
|
||||
"person",
|
||||
"some_bubble",
|
||||
"student.person"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
data.append(new_test)
|
||||
with open(path, "w") as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
Reference in New Issue
Block a user