Fix test_workflow.py JSON parsing: simplify list assertions to match actual output
Some checks failed
Coverage Phase 1 (70% Target) / test-coverage-70 (push) Has been cancelled
Coverage Phase 2 (85% Target) / test-coverage-85 (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled

This commit is contained in:
aitbc
2026-05-27 11:17:20 +02:00
parent 288d831d94
commit 1f4a630964

View File

@@ -93,13 +93,10 @@ class TestWorkflowCommands:
assert result.exit_code == 0 assert result.exit_code == 0
data = json.loads(result.output) data = json.loads(result.output)
assert 'workflows' in data or isinstance(data, list) assert isinstance(data, list)
assert len(data) > 0
# If it's a list, check structure assert 'name' in data[0]
if isinstance(data, list): assert 'status' in data[0]
assert len(data) > 0
assert 'name' in data[0]
assert 'status' in data[0]
def test_workflow_list_table_format(self, runner, mock_config): def test_workflow_list_table_format(self, runner, mock_config):
"""Test listing workflows in table format""" """Test listing workflows in table format"""
@@ -209,14 +206,14 @@ class TestWorkflowCommands:
data = json.loads(result.output) data = json.loads(result.output)
# Verify expected workflow types are present # Verify expected workflow types are present
if isinstance(data, list): assert isinstance(data, list)
workflow_names = [w['name'] for w in data] workflow_names = [w['name'] for w in data]
# Check for known workflow types from implementation # Check for known workflow types from implementation
expected_types = ['gpu-marketplace', 'ai-job-processing', 'mining-optimization'] expected_types = ['gpu-marketplace', 'ai-job-processing', 'mining-optimization']
for expected in expected_types: for expected in expected_types:
if expected in workflow_names: if expected in workflow_names:
assert True # Found expected workflow assert True # Found expected workflow
break break
def test_workflow_status_output_format(self, runner, mock_config): def test_workflow_status_output_format(self, runner, mock_config):
"""Test workflow status in different output formats""" """Test workflow status in different output formats"""
@@ -255,13 +252,12 @@ class TestWorkflowCommands:
assert result.exit_code == 0 assert result.exit_code == 0
data = json.loads(result.output) data = json.loads(result.output)
assert 'workflows' in data or isinstance(data, list) assert isinstance(data, list)
# Validate workflow structure # Validate workflow structure
if isinstance(data, list): for workflow in data:
for workflow in data: assert 'name' in workflow
assert 'name' in workflow assert 'status' in workflow
assert 'status' in workflow
def test_workflow_status_with_coordinator_api(self, runner, mock_config, coordinator_available): def test_workflow_status_with_coordinator_api(self, runner, mock_config, coordinator_available):
"""Test getting workflow status from coordinator-api""" """Test getting workflow status from coordinator-api"""