mirror of
https://github.com/johndoe6345789/AutoMetabuilder.git
synced 2026-04-24 13:54:59 +00:00
Fix error messages and test assertions based on code review feedback
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ try:
|
||||
import jsonschema
|
||||
from jsonschema import Draft202012Validator
|
||||
except ImportError:
|
||||
print("Error: jsonschema library not found. Install with: poetry add jsonschema")
|
||||
print("Error: jsonschema library not found. Install with: poetry install")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,8 @@ def test_validate_workflow_with_missing_name(tmp_path):
|
||||
|
||||
is_valid, error_msg = validate_workflow_file(workflow_file, schema)
|
||||
assert not is_valid
|
||||
assert "name" in error_msg.lower() or "required" in error_msg.lower()
|
||||
# jsonschema reports missing required property
|
||||
assert "required" in error_msg.lower() or "'name'" in error_msg
|
||||
|
||||
|
||||
def test_validate_workflow_with_empty_nodes(tmp_path):
|
||||
@@ -116,8 +117,8 @@ def test_validate_workflow_with_empty_nodes(tmp_path):
|
||||
|
||||
is_valid, error_msg = validate_workflow_file(workflow_file, schema)
|
||||
assert not is_valid
|
||||
# jsonschema will report "[] should be non-empty"
|
||||
assert "nodes" in error_msg.lower() or "empty" in error_msg.lower()
|
||||
# jsonschema reports "[] is too short" for minItems violation
|
||||
assert "too short" in error_msg.lower() and "nodes" in error_msg.lower()
|
||||
|
||||
|
||||
def test_validate_workflow_with_invalid_json(tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user