from fastapi.testclient import TestClient from exec_mcp.server import app client = TestClient(app) def test_health(): resp = client.get('/health') assert resp.status_code == 200 assert resp.json() == {'ok': True, 'server': 'exec-mcp'} def test_dashboard_account_crud_roundtrip(): payload = { 'display_name': 'Bitstamp Main', 'venue': 'bitstamp', 'venue_account_ref': '123456', 'api_key': 'key-123', 'api_secret': 'secret-123', 'description': 'primary account', 'enabled': 'on', } resp = client.post('/dashboard/accounts/create', data=payload, follow_redirects=True) assert resp.status_code == 200, resp.text assert 'Bitstamp Main' in resp.text assert '123456' in resp.text resp = client.get('/dashboard/accounts/bitstamp/123456/edit') assert resp.status_code == 200 assert 'Edit account' in resp.text resp = client.post( '/dashboard/accounts/bitstamp/123456/update', data={'display_name': 'Bitstamp Main', 'description': 'updated', 'enabled': 'on'}, follow_redirects=True, ) assert resp.status_code == 200 assert 'updated' in resp.text resp = client.post('/dashboard/accounts/bitstamp/123456/delete', follow_redirects=True) assert resp.status_code == 200 assert '123456' not in resp.text