mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 08:26:21 +02:00
Fix tests (#593)
* Fix unit/integration/contract tests which were broken by messaging fabric work
This commit is contained in:
parent
34eb083836
commit
5304f96fe6
19 changed files with 461 additions and 439 deletions
|
|
@ -23,9 +23,9 @@ class TestStructuredDiagnosisSchemaContract:
|
|||
|
||||
assert request.operation == "detect-type"
|
||||
assert request.sample == "test data"
|
||||
assert request.type is None # Optional, defaults to None
|
||||
assert request.schema_name is None # Optional, defaults to None
|
||||
assert request.options is None # Optional, defaults to None
|
||||
assert request.type == "" # Optional, defaults to empty string
|
||||
assert request.schema_name == "" # Optional, defaults to empty string
|
||||
assert request.options == {} # Optional, defaults to empty dict
|
||||
|
||||
def test_request_schema_all_operations(self):
|
||||
"""Test request schema supports all operations"""
|
||||
|
|
@ -66,9 +66,9 @@ class TestStructuredDiagnosisSchemaContract:
|
|||
assert response.detected_type == "xml"
|
||||
assert response.confidence == 0.9
|
||||
assert response.error is None
|
||||
assert response.descriptor is None
|
||||
assert response.metadata is None
|
||||
assert response.schema_matches is None # New field, defaults to None
|
||||
assert response.descriptor == "" # Defaults to empty string
|
||||
assert response.metadata == {} # Defaults to empty dict
|
||||
assert response.schema_matches == [] # Defaults to empty list
|
||||
|
||||
def test_response_schema_with_error(self):
|
||||
"""Test response schema with error"""
|
||||
|
|
@ -140,6 +140,7 @@ class TestStructuredDiagnosisSchemaContract:
|
|||
assert response.metadata == metadata
|
||||
assert response.metadata["field_count"] == "5"
|
||||
|
||||
@pytest.mark.skip(reason="JsonSchema requires Pulsar Record types, not dataclasses")
|
||||
def test_schema_serialization(self):
|
||||
"""Test that schemas can be serialized and deserialized correctly"""
|
||||
# Test request serialization
|
||||
|
|
@ -158,6 +159,7 @@ class TestStructuredDiagnosisSchemaContract:
|
|||
assert deserialized.sample == request.sample
|
||||
assert deserialized.options == request.options
|
||||
|
||||
@pytest.mark.skip(reason="JsonSchema requires Pulsar Record types, not dataclasses")
|
||||
def test_response_serialization_with_schema_matches(self):
|
||||
"""Test response serialization with schema_matches array"""
|
||||
response = StructuredDataDiagnosisResponse(
|
||||
|
|
@ -185,7 +187,7 @@ class TestStructuredDiagnosisSchemaContract:
|
|||
)
|
||||
|
||||
# Verify default value for new field
|
||||
assert response.schema_matches is None # Defaults to None when not set
|
||||
assert response.schema_matches == [] # Defaults to empty list when not set
|
||||
|
||||
# Verify old fields still work
|
||||
assert response.detected_type == "json"
|
||||
|
|
@ -221,7 +223,7 @@ class TestStructuredDiagnosisSchemaContract:
|
|||
)
|
||||
|
||||
assert error_response.error is not None
|
||||
assert error_response.schema_matches is None # Default None when not set
|
||||
assert error_response.schema_matches == [] # Default empty list when not set
|
||||
|
||||
def test_all_operations_supported(self):
|
||||
"""Verify all operations are properly supported in the contract"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue