From fc0e05a35e93b8e93801ca4f0572751bb7c0e702 Mon Sep 17 00:00:00 2001 From: aitbc Date: Wed, 27 May 2026 11:06:33 +0200 Subject: [PATCH] Fix Python test obj dicts: change output_format to output to match CLI --- tests/cli/test_client.py | 30 ++++++------ tests/cli/test_config.py | 64 +++++++++++++------------- tests/cli/test_config_profiles.py | 30 ++++++------ tests/cli/test_edge_advanced.py | 54 +++++++++++----------- tests/cli/test_exchange.py | 36 +++++++-------- tests/cli/test_governance.py | 48 +++++++++---------- tests/cli/test_marketplace.py | 22 ++++----- tests/cli/test_marketplace_bids.py | 26 +++++------ tests/cli/test_resource.py | 50 ++++++++++---------- tests/cli/test_simulate.py | 24 +++++----- tests/cli/test_simulate_integration.py | 46 +++++++++--------- tests/cli/test_wallet.py | 56 +++++++++++----------- tests/cli/test_workflow.py | 54 +++++++++++----------- 13 files changed, 270 insertions(+), 270 deletions(-) diff --git a/tests/cli/test_client.py b/tests/cli/test_client.py index a9472cb5..0120ef4b 100644 --- a/tests/cli/test_client.py +++ b/tests/cli/test_client.py @@ -42,7 +42,7 @@ class TestClientCommands: '--type', 'inference', '--prompt', 'Test prompt', '--model', 'test_model' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -79,7 +79,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'submit', '--file', str(job_file) - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -109,7 +109,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'status', 'test_job_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -136,7 +136,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'cancel', 'test_job_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -167,7 +167,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'blocks', '--limit', '2' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -201,7 +201,7 @@ class TestClientCommands: '--status', 'completed', '--type', 'inference', '--limit', '10' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -228,7 +228,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'status', 'test_job_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code != 0 @@ -238,7 +238,7 @@ class TestClientCommands: """Test submit command with missing required arguments""" result = runner.invoke(client, [ 'submit' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Error' in result.output @@ -263,7 +263,7 @@ class TestClientCommands: 'pay', 'job_123', '10.0', '--currency', 'AITBC', '--method', 'aitbc_token' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert 'pay_abc' in result.output @@ -280,7 +280,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'pay', 'job_123', '10.0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Payment failed' in result.output @@ -302,7 +302,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'payment-status', 'job_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert 'escrowed' in result.output @@ -318,7 +318,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'payment-status', 'job_999' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'No payment found' in result.output @@ -341,7 +341,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'payment-receipt', 'pay_abc' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert '0xabc123' in result.output @@ -362,7 +362,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'refund', 'job_123', 'pay_abc', '--reason', 'Job timed out' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert 'refunded' in result.output @@ -380,7 +380,7 @@ class TestClientCommands: result = runner.invoke(client, [ 'refund', 'job_123', 'pay_abc', '--reason', 'Changed mind' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Refund failed' in result.output diff --git a/tests/cli/test_config.py b/tests/cli/test_config.py index ad4f772e..cff6a29b 100644 --- a/tests/cli/test_config.py +++ b/tests/cli/test_config.py @@ -53,7 +53,7 @@ class TestConfigCommands: """Test showing current configuration""" result = runner.invoke(config, [ 'show' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -68,7 +68,7 @@ class TestConfigCommands: 'set', 'coordinator_url', 'http://new:8000' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Coordinator URL set to: http://new:8000' in result.output @@ -86,7 +86,7 @@ class TestConfigCommands: 'set', 'api_key', 'new_test_key_12345' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'API key set (use --global to set permanently)' in result.output @@ -98,7 +98,7 @@ class TestConfigCommands: 'set', 'timeout', '45' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Timeout set to: 45s' in result.output @@ -109,7 +109,7 @@ class TestConfigCommands: 'set', 'timeout', 'invalid' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Timeout must be an integer' in result.output @@ -120,7 +120,7 @@ class TestConfigCommands: 'set', 'invalid_key', 'value' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Unknown configuration key' in result.output @@ -130,7 +130,7 @@ class TestConfigCommands: with runner.isolated_filesystem(): result = runner.invoke(config, [ 'path' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert '.aitbc.yaml' in result.output @@ -140,7 +140,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'path', '--global' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert '.config/aitbc/config.yaml' in result.output @@ -156,7 +156,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'edit' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 # Verify editor was called @@ -177,7 +177,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'reset' - ], obj={'config': mock_config, 'output_format': 'json'}, input='n\n') + ], obj={'config': mock_config, 'output': 'json'}, input='n\n') assert result.exit_code == 0 # File should still exist @@ -195,7 +195,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'reset' - ], obj={'config': mock_config, 'output_format': 'table'}, input='y\n') + ], obj={'config': mock_config, 'output': 'table'}, input='y\n') assert result.exit_code == 0 assert 'Configuration reset' in result.output @@ -207,7 +207,7 @@ class TestConfigCommands: with runner.isolated_filesystem(): result = runner.invoke(config, [ 'reset' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert 'No configuration file found' in result.output @@ -225,7 +225,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'export', '--format', 'yaml' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 output_data = yaml.safe_load(result.output) @@ -245,7 +245,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'export', '--format', 'json' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -262,7 +262,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'export', '--format', 'json' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -278,7 +278,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'export', '--format', 'yaml' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 data = yaml.safe_load(result.output) @@ -289,7 +289,7 @@ class TestConfigCommands: with runner.isolated_filesystem(): result = runner.invoke(config, [ 'export' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'No configuration file found' in result.output @@ -311,7 +311,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'import-config', str(import_file) - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Configuration imported' in result.output @@ -341,7 +341,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'import-config', str(import_file) - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 @@ -372,7 +372,7 @@ class TestConfigCommands: 'import-config', str(import_file), '--merge' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 @@ -387,7 +387,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'import-config', '/nonexistent/file.yaml' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'File not found' in result.output @@ -396,7 +396,7 @@ class TestConfigCommands: """Test validating valid configuration""" result = runner.invoke(config, [ 'validate' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Configuration valid' in result.output @@ -407,7 +407,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'validate' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code != 0 assert 'validation failed' in result.output @@ -418,7 +418,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'validate' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code != 0 assert 'validation failed' in result.output @@ -429,7 +429,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'validate' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code != 0 assert 'validation failed' in result.output @@ -440,7 +440,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'validate' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'valid with warnings' in result.output @@ -450,7 +450,7 @@ class TestConfigCommands: """Test listing environment variables""" result = runner.invoke(config, [ 'environments' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'CLIENT_API_KEY' in result.output @@ -465,7 +465,7 @@ class TestConfigCommands: 'profiles', 'save', 'test_profile' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert "Profile 'test_profile' saved" in result.output @@ -496,7 +496,7 @@ class TestConfigCommands: result = runner.invoke(config, [ 'profiles', 'list' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'profile1' in result.output @@ -519,7 +519,7 @@ class TestConfigCommands: 'profiles', 'load', 'load_me' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert "Profile 'load_me' loaded" in result.output @@ -541,7 +541,7 @@ class TestConfigCommands: 'profiles', 'delete', 'delete_me' - ], obj={'config': mock_config, 'output_format': 'table'}, input='y\n') + ], obj={'config': mock_config, 'output': 'table'}, input='y\n') assert result.exit_code == 0 assert "Profile 'delete_me' deleted" in result.output @@ -564,7 +564,7 @@ class TestConfigCommands: 'profiles', 'delete', 'keep_me' - ], obj={'config': mock_config, 'output_format': 'json'}, input='n\n') + ], obj={'config': mock_config, 'output': 'json'}, input='n\n') assert result.exit_code == 0 assert profile_file.exists() # Should still exist diff --git a/tests/cli/test_config_profiles.py b/tests/cli/test_config_profiles.py index 5ffd87f6..e900b3a0 100644 --- a/tests/cli/test_config_profiles.py +++ b/tests/cli/test_config_profiles.py @@ -51,7 +51,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'save', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert f"Profile '{profile_name}' saved" in result.output @@ -83,7 +83,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'save', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 @@ -100,7 +100,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 import json @@ -127,7 +127,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -152,7 +152,7 @@ class TestConfigProfilesIntegration: with runner.isolated_filesystem(temp_dir=tmp_path): result = runner.invoke(config, [ 'profiles', 'load', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert f"Profile '{profile_name}' loaded" in result.output @@ -173,7 +173,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'load', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code != 0 assert "not found" in result.output @@ -196,7 +196,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'delete', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}, input='y\n') + ], obj={'config': mock_config, 'output': 'table'}, input='y\n') assert result.exit_code == 0 assert f"Profile '{profile_name}' deleted" in result.output @@ -218,7 +218,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'delete', profile_name - ], obj={'config': mock_config, 'output_format': 'json'}, input='n\n') + ], obj={'config': mock_config, 'output': 'json'}, input='n\n') assert result.exit_code == 0 assert profile_file.exists() # Should still exist @@ -230,7 +230,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'delete', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code != 0 assert "not found" in result.output @@ -245,13 +245,13 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'save', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 # List result = runner.invoke(config, [ 'profiles', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) assert profile_name in [p['name'] for p in data['profiles']] @@ -260,13 +260,13 @@ class TestConfigProfilesIntegration: with runner.isolated_filesystem(temp_dir=tmp_path): result = runner.invoke(config, [ 'profiles', 'load', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 # Delete result = runner.invoke(config, [ 'profiles', 'delete', profile_name - ], obj={'config': mock_config, 'output_format': 'table'}, input='y\n') + ], obj={'config': mock_config, 'output': 'table'}, input='y\n') assert result.exit_code == 0 # Verify deleted @@ -284,7 +284,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'save', 'different_profile' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 @@ -304,7 +304,7 @@ class TestConfigProfilesIntegration: result = runner.invoke(config, [ 'profiles', 'save', 'new_profile' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert profiles_dir.exists() diff --git a/tests/cli/test_edge_advanced.py b/tests/cli/test_edge_advanced.py index b6eed323..876df635 100644 --- a/tests/cli/test_edge_advanced.py +++ b/tests/cli/test_edge_advanced.py @@ -54,7 +54,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'island', 'leave', '--island-id', 'test_island_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -66,7 +66,7 @@ class TestEdgeAdvancedCommands: 'island', 'bridge', '--source', 'island_a', '--target', 'island_b' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -77,7 +77,7 @@ class TestEdgeAdvancedCommands: """Test listing GPUs""" result = runner.invoke(edge, [ 'gpu', 'list_gpus' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -88,7 +88,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'gpu', 'get_gpu', '--gpu-id', 'gpu_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -99,7 +99,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'gpu', 'remove_gpu', '--gpu-id', 'gpu_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -109,7 +109,7 @@ class TestEdgeAdvancedCommands: """Test scanning for available GPUs""" result = runner.invoke(edge, [ 'gpu', 'scan_gpus' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -120,7 +120,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'gpu', 'gpu_metrics', '--gpu-id', 'gpu_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -132,7 +132,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'database', 'init_db', '--db-name', 'test_db' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -142,7 +142,7 @@ class TestEdgeAdvancedCommands: """Test listing databases""" result = runner.invoke(edge, [ 'database', 'list_dbs' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -153,7 +153,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'database', 'get_db', '--db-id', 'db_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -164,7 +164,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'database', 'delete_db', '--db-id', 'db_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -175,7 +175,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'database', 'sync_db', '--db-id', 'db_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -188,7 +188,7 @@ class TestEdgeAdvancedCommands: 'serve', 'submit_request', '--request-type', 'compute', '--parameters', '{"gpu_count": 2}' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -198,7 +198,7 @@ class TestEdgeAdvancedCommands: """Test listing serve requests""" result = runner.invoke(edge, [ 'serve', 'list_requests' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -209,7 +209,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'serve', 'get_request', '--request-id', 'req_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -220,7 +220,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'serve', 'cancel_request', '--request-id', 'req_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -231,7 +231,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'serve', 'get_result', '--request-id', 'req_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -244,7 +244,7 @@ class TestEdgeAdvancedCommands: 'metrics', 'record', '--metric-name', 'test_metric', '--value', '100' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -254,7 +254,7 @@ class TestEdgeAdvancedCommands: """Test listing metrics""" result = runner.invoke(edge, [ 'metrics', 'list_metrics' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -265,7 +265,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'metrics', 'get_metric', '--metric-id', 'metric_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -276,7 +276,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'metrics', 'delete_metric', '--metric-id', 'metric_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -288,7 +288,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'island', 'leave', '--island-id', 'nonexistent_island' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should handle gracefully assert result.exit_code != 0 or 'not found' in result.output.lower() @@ -298,7 +298,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'gpu', 'get_gpu', '--gpu-id', 'nonexistent_gpu' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should handle gracefully assert result.exit_code != 0 or 'not found' in result.output.lower() @@ -310,7 +310,7 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'gpu', 'list_gpus' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should either fail gracefully or skip with appropriate message assert result.exit_code != 0 or 'error' in result.output.lower() or 'unavailable' in result.output.lower() @@ -320,7 +320,7 @@ class TestEdgeAdvancedCommands: """Test GPU list in table format""" result = runner.invoke(edge, [ 'gpu', 'list_gpus' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'GPU' in result.output or 'gpus' in result.output.lower() @@ -329,7 +329,7 @@ class TestEdgeAdvancedCommands: """Test database list in table format""" result = runner.invoke(edge, [ 'database', 'list_dbs' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Database' in result.output or 'databases' in result.output.lower() @@ -354,6 +354,6 @@ class TestEdgeAdvancedCommands: result = runner.invoke(edge, [ 'gpu', 'list_gpus' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 diff --git a/tests/cli/test_exchange.py b/tests/cli/test_exchange.py index 4f812a98..f7d37569 100644 --- a/tests/cli/test_exchange.py +++ b/tests/cli/test_exchange.py @@ -43,7 +43,7 @@ class TestExchangeRatesCommand: # Run command result = runner.invoke(exchange, ['rates'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -90,7 +90,7 @@ class TestExchangeRatesCommand: # Run command result = runner.invoke(exchange, ['rates'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -139,7 +139,7 @@ class TestExchangeCreatePaymentCommand: '--aitbc-amount', '1000', '--user-id', 'test_user', '--notes', 'Test payment' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -196,7 +196,7 @@ class TestExchangeCreatePaymentCommand: result = runner.invoke(exchange, [ 'create-payment', '--btc-amount', '0.005' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -212,7 +212,7 @@ class TestExchangeCreatePaymentCommand: """Test creating payment without specifying amount""" # Run command without amount result = runner.invoke(exchange, ['create-payment'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -224,7 +224,7 @@ class TestExchangeCreatePaymentCommand: result = runner.invoke(exchange, [ 'create-payment', '--aitbc-amount', '0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -236,7 +236,7 @@ class TestExchangeCreatePaymentCommand: result = runner.invoke(exchange, [ 'create-payment', '--btc-amount', '-0.01' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -256,7 +256,7 @@ class TestExchangeCreatePaymentCommand: result = runner.invoke(exchange, [ 'create-payment', '--aitbc-amount', '1000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -291,7 +291,7 @@ class TestExchangePaymentStatusCommand: result = runner.invoke(exchange, [ 'payment-status', '--payment-id', 'pay_123456' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -329,7 +329,7 @@ class TestExchangePaymentStatusCommand: result = runner.invoke(exchange, [ 'payment-status', '--payment-id', 'pay_123456' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -361,7 +361,7 @@ class TestExchangePaymentStatusCommand: result = runner.invoke(exchange, [ 'payment-status', '--payment-id', 'pay_123456' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -381,7 +381,7 @@ class TestExchangePaymentStatusCommand: result = runner.invoke(exchange, [ 'payment-status', '--payment-id', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -411,7 +411,7 @@ class TestExchangeMarketStatsCommand: # Run command result = runner.invoke(exchange, ['market-stats'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -472,7 +472,7 @@ class TestExchangeWalletCommands: # Run command result = runner.invoke(exchange, ['wallet', 'balance'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -506,7 +506,7 @@ class TestExchangeWalletCommands: # Run command result = runner.invoke(exchange, ['wallet', 'info'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -573,21 +573,21 @@ class TestExchangeIntegration: # Execute workflow # Get rates result1 = runner.invoke(exchange, ['rates'], - obj={'config': mock_config, 'output_format': 'json'}) + obj={'config': mock_config, 'output': 'json'}) assert result1.exit_code == 0 # Create payment result2 = runner.invoke(exchange, [ 'create-payment', '--aitbc-amount', '1000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result2.exit_code == 0 # Check payment status result3 = runner.invoke(exchange, [ 'payment-status', '--payment-id', 'pay_workflow_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result3.exit_code == 0 # Verify all API calls were made diff --git a/tests/cli/test_governance.py b/tests/cli/test_governance.py index 040ecc49..c09f4da2 100644 --- a/tests/cli/test_governance.py +++ b/tests/cli/test_governance.py @@ -60,7 +60,7 @@ class TestGovernanceCommands: 'propose', 'Test Proposal', '--description', 'A test proposal', '--duration', '7' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -78,7 +78,7 @@ class TestGovernanceCommands: '--type', 'parameter_change', '--parameter', 'block_size', '--value', '2000000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -92,7 +92,7 @@ class TestGovernanceCommands: '--description', 'Fund development', '--type', 'funding', '--amount', '10000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -105,14 +105,14 @@ class TestGovernanceCommands: result = runner.invoke(operations, ['governance', 'propose', 'Vote Test', '--description', 'Test voting' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) proposal_id = extract_json_from_output(result.output)['proposal_id'] # Vote result = runner.invoke(operations, ['governance', 'vote', proposal_id, 'for', '--voter', 'alice' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -126,13 +126,13 @@ class TestGovernanceCommands: result = runner.invoke(operations, ['governance', 'propose', 'Against Test', '--description', 'Test against' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) proposal_id = extract_json_from_output(result.output)['proposal_id'] result = runner.invoke(operations, ['governance', 'vote', proposal_id, 'against', '--voter', 'bob' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -144,13 +144,13 @@ class TestGovernanceCommands: result = runner.invoke(operations, ['governance', 'propose', 'Weight Test', '--description', 'Test weights' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) proposal_id = extract_json_from_output(result.output)['proposal_id'] result = runner.invoke(operations, ['governance', 'vote', proposal_id, 'for', '--voter', 'whale', '--weight', '10.0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -163,16 +163,16 @@ class TestGovernanceCommands: result = runner.invoke(operations, ['governance', 'propose', 'Dup Test', '--description', 'Test duplicate' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) proposal_id = extract_json_from_output(result.output)['proposal_id'] runner.invoke(operations, ['governance', 'vote', proposal_id, 'for', '--voter', 'alice' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) result = runner.invoke(operations, ['governance', 'vote', proposal_id, 'for', '--voter', 'alice' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'already voted' in result.output @@ -182,7 +182,7 @@ class TestGovernanceCommands: with patch('aitbc_cli.commands.operations.GOVERNANCE_DIR', governance_dir): result = runner.invoke(operations, ['governance', 'vote', 'nonexistent', 'for' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'not found' in result.output @@ -193,14 +193,14 @@ class TestGovernanceCommands: # Create two proposals runner.invoke(operations, ['governance', 'propose', 'Prop A', '--description', 'First' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) runner.invoke(operations, ['governance', 'propose', 'Prop B', '--description', 'Second' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) result = runner.invoke(operations, ['governance', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -211,11 +211,11 @@ class TestGovernanceCommands: with patch('aitbc_cli.commands.operations.GOVERNANCE_DIR', governance_dir): runner.invoke(operations, ['governance', 'propose', 'Active Prop', '--description', 'Active' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) result = runner.invoke(operations, ['governance', 'list', '--status', 'active' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -228,23 +228,23 @@ class TestGovernanceCommands: result = runner.invoke(operations, ['governance', 'propose', 'Result Test', '--description', 'Test results' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) proposal_id = extract_json_from_output(result.output)['proposal_id'] # Cast votes runner.invoke(operations, ['governance', 'vote', proposal_id, 'for', '--voter', 'alice' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) runner.invoke(operations, ['governance', 'vote', proposal_id, 'against', '--voter', 'bob' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) runner.invoke(operations, ['governance', 'vote', proposal_id, 'for', '--voter', 'charlie' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) result = runner.invoke(operations, ['governance', 'result', proposal_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -258,7 +258,7 @@ class TestGovernanceCommands: with patch('aitbc_cli.commands.operations.GOVERNANCE_DIR', governance_dir): result = runner.invoke(operations, ['governance', 'result', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'not found' in result.output diff --git a/tests/cli/test_marketplace.py b/tests/cli/test_marketplace.py index 5c40ffae..6cad6760 100644 --- a/tests/cli/test_marketplace.py +++ b/tests/cli/test_marketplace.py @@ -59,7 +59,7 @@ class TestMarketplaceCommands: result = runner.invoke(marketplace, [ 'gpu', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -102,7 +102,7 @@ class TestMarketplaceCommands: 'gpu', 'list', '--available' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -146,7 +146,7 @@ class TestMarketplaceCommands: '--model', 'RTX4090', '--memory-min', '16', '--price-max', '1.0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -188,7 +188,7 @@ class TestMarketplaceCommands: 'gpu', 'details', 'gpu1' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -227,7 +227,7 @@ class TestMarketplaceCommands: 'book', 'gpu1', '--hours', '2' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -288,7 +288,7 @@ class TestMarketplaceCommands: 'gpu', 'release', 'gpu1' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -347,7 +347,7 @@ class TestMarketplaceCommands: # Run command result = runner.invoke(marketplace, [ 'orders' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -408,7 +408,7 @@ class TestMarketplaceCommands: result = runner.invoke(marketplace, [ 'pricing', 'RTX4090' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -455,7 +455,7 @@ class TestMarketplaceCommands: result = runner.invoke(marketplace, [ 'reviews', 'gpu1' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -492,7 +492,7 @@ class TestMarketplaceCommands: 'gpu1', '--rating', '5', '--comment', 'Amazing GPU!' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -546,7 +546,7 @@ class TestMarketplaceCommands: 'gpu', 'details', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 # The command doesn't exit on error diff --git a/tests/cli/test_marketplace_bids.py b/tests/cli/test_marketplace_bids.py index 241ae5c6..b0e8fb4b 100644 --- a/tests/cli/test_marketplace_bids.py +++ b/tests/cli/test_marketplace_bids.py @@ -47,7 +47,7 @@ class TestMarketplaceBidCommands: '--capacity', '100', '--price', '0.05', '--notes', 'Need GPU capacity for AI training' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -100,7 +100,7 @@ class TestMarketplaceBidCommands: '--provider', 'miner123', '--capacity', '0', # Invalid: must be > 0 '--price', '0.05' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -119,7 +119,7 @@ class TestMarketplaceBidCommands: '--provider', 'miner123', '--capacity', '100', '--price', '-0.05' # Invalid: must be > 0 - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -146,7 +146,7 @@ class TestMarketplaceBidCommands: '--provider', 'invalid_provider', '--capacity', '100', '--price', '0.05' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -187,7 +187,7 @@ class TestMarketplaceBidCommands: result = runner.invoke(marketplace, [ 'bid', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -232,7 +232,7 @@ class TestMarketplaceBidCommands: '--status', 'pending', '--provider', 'miner123', '--limit', '10' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -268,7 +268,7 @@ class TestMarketplaceBidCommands: 'bid', 'details', 'bid123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -301,7 +301,7 @@ class TestMarketplaceBidCommands: 'bid', 'details', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -349,7 +349,7 @@ class TestMarketplaceOffersCommands: result = runner.invoke(marketplace, [ 'offers', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -399,7 +399,7 @@ class TestMarketplaceOffersCommands: '--memory-min', '16', '--region', 'us-west', '--limit', '10' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -471,7 +471,7 @@ class TestMarketplaceBidIntegration: 'offers', 'list', '--status', 'open' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result1.exit_code == 0 # Submit bid @@ -481,7 +481,7 @@ class TestMarketplaceBidIntegration: '--provider', 'miner123', '--capacity', '100', '--price', '0.05' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result2.exit_code == 0 # Check bid details @@ -489,7 +489,7 @@ class TestMarketplaceBidIntegration: 'bid', 'details', 'bid123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result3.exit_code == 0 # Verify all API calls were made diff --git a/tests/cli/test_resource.py b/tests/cli/test_resource.py index 5d3ca977..603faa61 100644 --- a/tests/cli/test_resource.py +++ b/tests/cli/test_resource.py @@ -68,7 +68,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 mock_client.get.assert_called_once_with("/api/v1/resources/status") @@ -94,7 +94,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status', '--resource-id', 'res_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 mock_client.get.assert_called_once_with("/api/v1/resources/res_123/status") @@ -118,7 +118,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'deallocate', 'res_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 mock_client.post.assert_called_once_with("/api/v1/resources/res_123/deallocate") @@ -142,7 +142,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'deallocate', 'res_123', '--force' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 mock_client.post.assert_called_once_with("/api/v1/resources/res_123/deallocate") @@ -162,7 +162,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert "Network error" in result.output @@ -182,7 +182,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'deallocate', 'res_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert "Network error" in result.output @@ -193,7 +193,7 @@ class TestResourceCommands: 'allocate', '--resource-type', 'gpu', '--quantity', '4' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) # Should fail with experimental warning assert result.exit_code != 0 @@ -204,7 +204,7 @@ class TestResourceCommands: """Test that list command shows experimental warning without --mock""" result = runner.invoke(resource, [ 'list' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) # Should fail with experimental warning assert result.exit_code != 0 @@ -215,7 +215,7 @@ class TestResourceCommands: """Test that release command shows experimental warning without --mock""" result = runner.invoke(resource, [ 'release', 'res_123' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) # Should fail with experimental warning assert result.exit_code != 0 @@ -226,7 +226,7 @@ class TestResourceCommands: """Test that utilization command shows experimental warning without --mock""" result = runner.invoke(resource, [ 'utilization' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) # Should fail with experimental warning assert result.exit_code != 0 @@ -237,7 +237,7 @@ class TestResourceCommands: """Test that optimize command shows experimental warning without --mock""" result = runner.invoke(resource, [ 'optimize' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) # Should fail with experimental warning assert result.exit_code != 0 @@ -263,7 +263,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert "Resource Status" in result.output @@ -286,7 +286,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'deallocate', 'res_123' - ], obj={'config': mock_config, 'output_format': 'json'}, input='y\n') + ], obj={'config': mock_config, 'output': 'json'}, input='y\n') assert result.exit_code == 0 mock_client.post.assert_called_once_with("/api/v1/resources/res_123/deallocate") @@ -305,7 +305,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'deallocate', 'res_123' - ], obj={'config': mock_config, 'output_format': 'json'}, input='n\n') + ], obj={'config': mock_config, 'output': 'json'}, input='n\n') assert result.exit_code == 0 # Should not call post if cancelled @@ -326,7 +326,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 mock_client.get.assert_called_once_with("/api/v1/resources/status") @@ -335,7 +335,7 @@ class TestResourceCommands: """Test resource status with actual coordinator-api call""" result = runner.invoke(resource, [ 'status' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -346,7 +346,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'deallocate', 'test_res_123', '--force' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -359,7 +359,7 @@ class TestResourceCommands: '--resource-type', 'gpu', '--quantity', '4', '--mock' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -370,7 +370,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'list', '--mock' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -381,7 +381,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'release', 'test_res_123', '--mock' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -392,7 +392,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'utilization', '--mock' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -403,7 +403,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'optimize', '--mock' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -417,7 +417,7 @@ class TestResourceCommands: '--quantity', '8', '--min-memory', '32', '--mock' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -428,7 +428,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status', '--resource-type', 'gpu' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -444,7 +444,7 @@ class TestResourceCommands: result = runner.invoke(resource, [ 'status' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should either fail gracefully or skip with appropriate message assert result.exit_code != 0 or 'error' in result.output.lower() or 'unavailable' in result.output.lower() diff --git a/tests/cli/test_simulate.py b/tests/cli/test_simulate.py index 843bcee0..9e8a51c3 100644 --- a/tests/cli/test_simulate.py +++ b/tests/cli/test_simulate.py @@ -106,7 +106,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'init', '--distribute', '5000,2000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -135,7 +135,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'init', '--reset' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -160,7 +160,7 @@ class TestSimulateCommands: '--type', 'client', '--name', 'testuser', '--balance', '1000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -188,7 +188,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'user', 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -217,7 +217,7 @@ class TestSimulateCommands: 'user', 'balance', 'testuser' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -246,7 +246,7 @@ class TestSimulateCommands: 'fund', 'testuser', '500' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -261,7 +261,7 @@ class TestSimulateCommands: 'workflow', '--jobs', '5', '--rounds', '2' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # The command should exist assert result.exit_code == 0 @@ -278,7 +278,7 @@ class TestSimulateCommands: '--miners', '1', '--duration', '5', '--job-rate', '2' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # The command should exist assert result.exit_code == 0 @@ -316,7 +316,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'scenario', '--file', str(scenario_file) - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert "Running scenario: Test Scenario" in result.output @@ -326,7 +326,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'results', 'sim_123' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 # Extract JSON from output @@ -353,7 +353,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'init', '--reset' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 @@ -364,7 +364,7 @@ class TestSimulateCommands: result = runner.invoke(simulate, [ 'init', '--distribute', 'invalid' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Assertions assert result.exit_code == 0 diff --git a/tests/cli/test_simulate_integration.py b/tests/cli/test_simulate_integration.py index e0a0d327..88ffff63 100644 --- a/tests/cli/test_simulate_integration.py +++ b/tests/cli/test_simulate_integration.py @@ -54,7 +54,7 @@ class TestSimulateCommandsIntegration: 'blockchain', '--blocks', '10', '--transactions', '50' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -66,7 +66,7 @@ class TestSimulateCommandsIntegration: 'wallets', '--count', '5', '--balance', '1000' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -78,7 +78,7 @@ class TestSimulateCommandsIntegration: 'price', '--days', '30', '--volatility', '0.1' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -90,7 +90,7 @@ class TestSimulateCommandsIntegration: 'network', '--nodes', '10', '--latency', '50' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -102,7 +102,7 @@ class TestSimulateCommandsIntegration: 'ai-jobs', '--jobs', '20', '--duration', '300' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -114,7 +114,7 @@ class TestSimulateCommandsIntegration: 'run', '--type', 'blockchain', '--duration', '60' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -126,7 +126,7 @@ class TestSimulateCommandsIntegration: run_result = runner.invoke(simulate, [ 'run', '--type', 'blockchain' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert run_result.exit_code == 0 run_data = json.loads(run_result.output) @@ -136,7 +136,7 @@ class TestSimulateCommandsIntegration: # Get status status_result = runner.invoke(simulate, [ 'status', sim_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert status_result.exit_code == 0 status_data = json.loads(status_result.output) @@ -148,7 +148,7 @@ class TestSimulateCommandsIntegration: run_result = runner.invoke(simulate, [ 'run', '--type', 'wallets' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert run_result.exit_code == 0 run_data = json.loads(run_result.output) @@ -158,7 +158,7 @@ class TestSimulateCommandsIntegration: # Get results result_result = runner.invoke(simulate, [ 'result', sim_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result_result.exit_code == 0 result_data = json.loads(result_result.output) @@ -171,7 +171,7 @@ class TestSimulateCommandsIntegration: '--blocks', '100', '--transactions', '500', '--difficulty', '5' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -183,7 +183,7 @@ class TestSimulateCommandsIntegration: 'wallets', '--count', '10', '--distribution', 'exponential' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -196,7 +196,7 @@ class TestSimulateCommandsIntegration: '--days', '90', '--trend', 'bullish', '--volatility', '0.15' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -209,7 +209,7 @@ class TestSimulateCommandsIntegration: '--nodes', '20', '--topology', 'mesh', '--latency', '100' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -222,7 +222,7 @@ class TestSimulateCommandsIntegration: '--jobs', '30', '--gpu-required', '--duration', '600' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -235,7 +235,7 @@ class TestSimulateCommandsIntegration: '--type', 'network', '--async', '--duration', '120' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -246,7 +246,7 @@ class TestSimulateCommandsIntegration: """Test getting status of non-existent simulation""" result = runner.invoke(simulate, [ 'status', 'sim_nonexistent_12345' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should handle gracefully assert result.exit_code != 0 or 'not found' in result.output.lower() @@ -255,7 +255,7 @@ class TestSimulateCommandsIntegration: """Test getting results of non-existent simulation""" result = runner.invoke(simulate, [ 'result', 'sim_nonexistent_12345' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should handle gracefully assert result.exit_code != 0 or 'not found' in result.output.lower() @@ -269,7 +269,7 @@ class TestSimulateCommandsIntegration: 'run', '--type', 'blockchain', '--async' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -287,7 +287,7 @@ class TestSimulateCommandsIntegration: result = runner.invoke(simulate, [ 'blockchain' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should either fail gracefully or skip with appropriate message assert result.exit_code != 0 or 'error' in result.output.lower() or 'unavailable' in result.output.lower() @@ -312,7 +312,7 @@ class TestSimulateCommandsIntegration: result = runner.invoke(simulate, [ 'blockchain', '--blocks', '10' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 # Verify API was called (if simulate command uses coordinator-api) @@ -323,7 +323,7 @@ class TestSimulateCommandsIntegration: result_json = runner.invoke(simulate, [ 'blockchain', '--blocks', '5' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result_json.exit_code == 0 json.loads(result_json.output) # Should be valid JSON @@ -332,6 +332,6 @@ class TestSimulateCommandsIntegration: result_table = runner.invoke(simulate, [ 'blockchain', '--blocks', '5' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result_table.exit_code == 0 diff --git a/tests/cli/test_wallet.py b/tests/cli/test_wallet.py index 74fd4fb7..853fc79e 100644 --- a/tests/cli/test_wallet.py +++ b/tests/cli/test_wallet.py @@ -78,7 +78,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'balance' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -92,7 +92,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', str(wallet_path), 'balance' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert wallet_path.exists() @@ -109,7 +109,7 @@ class TestWalletCommands: '25.5', 'job_456', '--desc', 'Another test job' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -129,7 +129,7 @@ class TestWalletCommands: 'spend', '30.0', 'GPU rental' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -143,7 +143,7 @@ class TestWalletCommands: 'spend', '200.0', 'Too much' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Insufficient balance' in result.output @@ -154,7 +154,7 @@ class TestWalletCommands: '--wallet-path', temp_wallet, 'history', '--limit', '5' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -167,7 +167,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'address' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -178,7 +178,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'stats' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -205,7 +205,7 @@ class TestWalletCommands: 'aitbc1recipient', '25.0', '--description', 'Payment' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -227,7 +227,7 @@ class TestWalletCommands: 'aitbc1payer', '50.0', '--description', 'Service payment' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -244,7 +244,7 @@ class TestWalletCommands: 'send', 'aitbc1recipient', '200.0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Insufficient balance' in result.output @@ -257,7 +257,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', str(wallet_path), 'balance' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 assert wallet_path.exists() @@ -270,7 +270,7 @@ class TestWalletCommands: 'stake', '50.0', '--duration', '30' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -293,7 +293,7 @@ class TestWalletCommands: '--wallet-path', temp_wallet, 'stake', '200.0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Insufficient balance' in result.output @@ -306,7 +306,7 @@ class TestWalletCommands: 'stake', '50.0', '--duration', '30' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 stake_data = extract_json_from_output(result.output) stake_id = stake_data['stake_id'] @@ -316,7 +316,7 @@ class TestWalletCommands: '--wallet-path', temp_wallet, 'unstake', stake_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -332,7 +332,7 @@ class TestWalletCommands: '--wallet-path', temp_wallet, 'unstake', 'nonexistent_stake' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'not found' in result.output @@ -343,13 +343,13 @@ class TestWalletCommands: runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'stake', '30.0', '--duration', '60' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Check staking info result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'staking-info' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -364,7 +364,7 @@ class TestWalletCommands: 'liquidity-stake', '40.0', '--pool', 'main', '--lock-days', '0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -381,7 +381,7 @@ class TestWalletCommands: '--wallet-path', temp_wallet, 'liquidity-stake', '30.0', '--lock-days', '30' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -393,7 +393,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'liquidity-stake', '500.0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'Insufficient balance' in result.output @@ -406,7 +406,7 @@ class TestWalletCommands: 'liquidity-stake', '50.0', '--pool', 'main', '--lock-days', '0' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 stake_id = extract_json_from_output(result.output)['stake_id'] @@ -414,7 +414,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'liquidity-unstake', stake_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) @@ -428,7 +428,7 @@ class TestWalletCommands: result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'liquidity-unstake', 'nonexistent' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code != 0 assert 'not found' in result.output @@ -439,17 +439,17 @@ class TestWalletCommands: runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'stake', '20.0', '--duration', '30' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'liquidity-stake', '20.0', '--pool', 'main' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) result = runner.invoke(wallet, [ '--wallet-path', temp_wallet, 'rewards' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = extract_json_from_output(result.output) diff --git a/tests/cli/test_workflow.py b/tests/cli/test_workflow.py index 1a9c2c98..d49df1af 100644 --- a/tests/cli/test_workflow.py +++ b/tests/cli/test_workflow.py @@ -54,7 +54,7 @@ class TestWorkflowCommands: """Test running a basic workflow""" result = runner.invoke(workflow, [ 'run', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'test_workflow' in result.output @@ -68,7 +68,7 @@ class TestWorkflowCommands: result = runner.invoke(workflow, [ 'run', 'test_workflow', '--config', str(config_file) - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'test_workflow' in result.output @@ -79,7 +79,7 @@ class TestWorkflowCommands: result = runner.invoke(workflow, [ 'run', 'test_workflow', '--dry-run' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Dry run' in result.output @@ -89,7 +89,7 @@ class TestWorkflowCommands: """Test listing available workflows""" result = runner.invoke(workflow, [ 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -106,7 +106,7 @@ class TestWorkflowCommands: result = runner.invoke(workflow, [ 'list', '--format', 'table' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'Available workflows' in result.output @@ -115,7 +115,7 @@ class TestWorkflowCommands: """Test getting workflow status""" result = runner.invoke(workflow, [ 'status', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'test_workflow' in result.output @@ -125,7 +125,7 @@ class TestWorkflowCommands: """Test stopping a workflow""" result = runner.invoke(workflow, [ 'stop', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert 'test_workflow' in result.output @@ -150,7 +150,7 @@ class TestWorkflowCommands: result = runner.invoke(workflow, [ 'run', 'api_workflow' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 # Verify API was called (if workflow command uses coordinator-api) @@ -160,13 +160,13 @@ class TestWorkflowCommands: """Test that workflow execution generates unique IDs""" result1 = runner.invoke(workflow, [ 'run', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) time.sleep(0.1) # Small delay to ensure different timestamp result2 = runner.invoke(workflow, [ 'run', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result1.exit_code == 0 assert result2.exit_code == 0 @@ -184,7 +184,7 @@ class TestWorkflowCommands: """Test getting status of non-existent workflow""" result = runner.invoke(workflow, [ 'status', 'nonexistent_workflow_xyz' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 # Should return status even for non-existent workflows @@ -194,7 +194,7 @@ class TestWorkflowCommands: """Test stopping non-existent workflow""" result = runner.invoke(workflow, [ 'stop', 'nonexistent_workflow_xyz' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 # Should attempt to stop even if not running @@ -212,7 +212,7 @@ class TestWorkflowCommands: for name in special_names: result = runner.invoke(workflow, [ 'run', name - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result.exit_code == 0 assert name in result.output @@ -221,7 +221,7 @@ class TestWorkflowCommands: """Test workflow listing with potential filters""" result = runner.invoke(workflow, [ 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -241,14 +241,14 @@ class TestWorkflowCommands: # Table format result_table = runner.invoke(workflow, [ 'status', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'table'}) + ], obj={'config': mock_config, 'output': 'table'}) assert result_table.exit_code == 0 # JSON format result_json = runner.invoke(workflow, [ 'status', 'test_workflow' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result_json.exit_code == 0 # Should be parseable as JSON or contain status info @@ -258,7 +258,7 @@ class TestWorkflowCommands: result = runner.invoke(workflow, [ 'run', 'test_integration_workflow', '--async' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -269,7 +269,7 @@ class TestWorkflowCommands: """Test listing workflows from coordinator-api""" result = runner.invoke(workflow, [ 'list' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -286,7 +286,7 @@ class TestWorkflowCommands: # First run a workflow run_result = runner.invoke(workflow, [ 'run', 'status_test_workflow' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert run_result.exit_code == 0 run_data = json.loads(run_result.output) @@ -296,7 +296,7 @@ class TestWorkflowCommands: # Get status status_result = runner.invoke(workflow, [ 'status', workflow_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert status_result.exit_code == 0 status_data = json.loads(status_result.output) @@ -308,7 +308,7 @@ class TestWorkflowCommands: # Run a workflow run_result = runner.invoke(workflow, [ 'run', 'stop_test_workflow' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert run_result.exit_code == 0 run_data = json.loads(run_result.output) @@ -318,7 +318,7 @@ class TestWorkflowCommands: # Stop the workflow stop_result = runner.invoke(workflow, [ 'stop', workflow_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert stop_result.exit_code == 0 stop_data = json.loads(stop_result.output) @@ -330,7 +330,7 @@ class TestWorkflowCommands: 'run', 'param_test_workflow', '--param', 'gpu_count=4', '--param', 'timeout=300' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert result.exit_code == 0 data = json.loads(result.output) @@ -341,7 +341,7 @@ class TestWorkflowCommands: # Start workflow run_result = runner.invoke(workflow, [ 'run', 'tracking_test_workflow' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert run_result.exit_code == 0 run_data = json.loads(run_result.output) @@ -351,7 +351,7 @@ class TestWorkflowCommands: # Check status immediately status1 = runner.invoke(workflow, [ 'status', workflow_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert status1.exit_code == 0 @@ -360,7 +360,7 @@ class TestWorkflowCommands: status2 = runner.invoke(workflow, [ 'status', workflow_id - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) assert status2.exit_code == 0 status2_data = json.loads(status2.output) @@ -373,7 +373,7 @@ class TestWorkflowCommands: result = runner.invoke(workflow, [ 'run', 'error_test_workflow' - ], obj={'config': mock_config, 'output_format': 'json'}) + ], obj={'config': mock_config, 'output': 'json'}) # Should either fail gracefully or skip with appropriate message # The exact behavior depends on implementation