chore(security): enhance environment configuration, CI workflows, and wallet daemon with security improvements
- Restructure .env.example with security-focused documentation, service-specific environment file references, and AWS Secrets Manager integration - Update CLI tests workflow to single Python 3.13 version, add pytest-mock dependency, and consolidate test execution with coverage - Add comprehensive security validation to package publishing workflow with manual approval gates, secret scanning, and release
This commit is contained in:
@@ -15,4 +15,56 @@ def runner():
|
||||
|
||||
@pytest.fixture
|
||||
def mock_config():
|
||||
"""Mock configu
|
||||
"""Mock configuration for testing"""
|
||||
return {
|
||||
'coordinator_url': 'http://localhost:8000',
|
||||
'api_key': 'test-key',
|
||||
'wallet_name': 'test-wallet'
|
||||
}
|
||||
|
||||
|
||||
class TestMarketplaceCommands:
|
||||
"""Test suite for marketplace commands"""
|
||||
|
||||
def test_marketplace_help(self, runner):
|
||||
"""Test marketplace help command"""
|
||||
result = runner.invoke(cli, ['marketplace', '--help'])
|
||||
assert result.exit_code == 0
|
||||
assert 'marketplace' in result.output.lower()
|
||||
|
||||
def test_marketplace_list(self, runner, mock_config):
|
||||
"""Test marketplace listing command"""
|
||||
with patch('aitbc_cli.config.get_config') as mock_get_config:
|
||||
mock_get_config.return_value = mock_config
|
||||
with patch('httpx.Client.get') as mock_get:
|
||||
mock_response = Mock()
|
||||
mock_response.status_code = 200
|
||||
mock_response.json.return_value = {
|
||||
'offers': [
|
||||
{'id': 1, 'price': 0.1, 'gpu_type': 'RTX 3080'},
|
||||
{'id': 2, 'price': 0.15, 'gpu_type': 'RTX 3090'}
|
||||
]
|
||||
}
|
||||
mock_get.return_value = mock_response
|
||||
|
||||
result = runner.invoke(cli, ['marketplace', 'offers', 'list'])
|
||||
assert result.exit_code == 0
|
||||
assert 'offers' in result.output.lower() or 'gpu' in result.output.lower()
|
||||
|
||||
def test_marketplace_gpu_pricing(self, runner, mock_config):
|
||||
"""Test marketplace GPU pricing command"""
|
||||
with patch('aitbc_cli.config.get_config') as mock_get_config:
|
||||
mock_get_config.return_value = mock_config
|
||||
with patch('httpx.Client.get') as mock_get:
|
||||
mock_response = Mock()
|
||||
mock_response.status_code = 200
|
||||
mock_response.json.return_value = {
|
||||
'gpu_model': 'RTX 3080',
|
||||
'avg_price': 0.12,
|
||||
'price_range': {'min': 0.08, 'max': 0.15}
|
||||
}
|
||||
mock_get.return_value = mock_response
|
||||
|
||||
result = runner.invoke(cli, ['marketplace', 'pricing', 'RTX 3080'])
|
||||
assert result.exit_code == 0
|
||||
assert 'price' in result.output.lower() or 'rtx' in result.output.lower()
|
||||
Reference in New Issue
Block a user