fix: add auth headers to ontology upload request and enhance ontology content
This commit is contained in:
parent
ccea3c39d4
commit
30e3971d44
1 changed files with 47 additions and 6 deletions
|
|
@ -98,15 +98,56 @@ class TestCogneeServerStart(unittest.TestCase):
|
||||||
if add_response.status_code not in [200, 201]:
|
if add_response.status_code not in [200, 201]:
|
||||||
add_response.raise_for_status()
|
add_response.raise_for_status()
|
||||||
|
|
||||||
ontology_content = b"""<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:owl='http://www.w3.org/2002/07/owl#'>
|
ontology_content = b"""<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
<owl:Class rdf:ID='Programmer'/><rdf:Description rdf:about='#Programmer'/>
|
xmlns:owl="http://www.w3.org/2002/07/owl#"
|
||||||
<owl:Class rdf:ID='LightBulb'/><rdf:Description rdf:about='#LightBulb'/>
|
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
||||||
<owl:Class rdf:ID='HardwareProblem'/><rdf:Description rdf:about='#HardwareProblem'/>
|
xmlns="http://example.org/ontology#"
|
||||||
<owl:Class rdf:ID='SoftwareProblem'/><rdf:Description rdf:about='#SoftwareProblem'/>
|
xml:base="http://example.org/ontology">
|
||||||
</rdf:RDF>"""
|
|
||||||
|
<owl:Ontology rdf:about="http://example.org/ontology"/>
|
||||||
|
|
||||||
|
<!-- Classes -->
|
||||||
|
<owl:Class rdf:ID="Problem"/>
|
||||||
|
<owl:Class rdf:ID="HardwareProblem"/>
|
||||||
|
<owl:Class rdf:ID="SoftwareProblem"/>
|
||||||
|
<owl:Class rdf:ID="Concept"/>
|
||||||
|
<owl:Class rdf:ID="Object"/>
|
||||||
|
<owl:Class rdf:ID="Joke"/>
|
||||||
|
<owl:Class rdf:ID="Image"/>
|
||||||
|
<owl:Class rdf:ID="Person"/>
|
||||||
|
|
||||||
|
<rdf:Description rdf:about="#HardwareProblem">
|
||||||
|
<rdfs:subClassOf rdf:resource="#Problem"/>
|
||||||
|
<rdfs:comment>A failure caused by physical components.</rdfs:comment>
|
||||||
|
</rdf:Description>
|
||||||
|
|
||||||
|
<rdf:Description rdf:about="#SoftwareProblem">
|
||||||
|
<rdfs:subClassOf rdf:resource="#Problem"/>
|
||||||
|
<rdfs:comment>An error caused by software logic or configuration.</rdfs:comment>
|
||||||
|
</rdf:Description>
|
||||||
|
|
||||||
|
<rdf:Description rdf:about="#Person">
|
||||||
|
<rdfs:comment>A human being or individual.</rdfs:comment>
|
||||||
|
</rdf:Description>
|
||||||
|
|
||||||
|
<!-- Individuals -->
|
||||||
|
<Person rdf:ID="programmers">
|
||||||
|
<rdfs:label>Programmers</rdfs:label>
|
||||||
|
</Person>
|
||||||
|
|
||||||
|
<Object rdf:ID="light_bulb">
|
||||||
|
<rdfs:label>Light Bulb</rdfs:label>
|
||||||
|
</Object>
|
||||||
|
|
||||||
|
<HardwareProblem rdf:ID="hardware_problem">
|
||||||
|
<rdfs:label>Hardware Problem</rdfs:label>
|
||||||
|
</HardwareProblem>
|
||||||
|
|
||||||
|
</rdf:RDF>"""
|
||||||
|
|
||||||
ontology_response = requests.post(
|
ontology_response = requests.post(
|
||||||
"http://127.0.0.1:8000/api/v1/ontologies",
|
"http://127.0.0.1:8000/api/v1/ontologies",
|
||||||
|
headers=headers,
|
||||||
files=[("ontology_file", ("test.owl", ontology_content, "application/xml"))],
|
files=[("ontology_file", ("test.owl", ontology_content, "application/xml"))],
|
||||||
data={
|
data={
|
||||||
"ontology_key": json.dumps([ontology_key]),
|
"ontology_key": json.dumps([ontology_key]),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue