Files
dss/tools/api/tests/conftest.py
Digital Production Factory 276ed71f31 Initial commit: Clean DSS implementation
Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm

Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)

Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability

Migration completed: $(date)
🤖 Clean migration with full functionality preserved
2025-12-09 18:45:48 -03:00

103 lines
3.3 KiB
Python

"""
Pytest configuration and shared fixtures for API tests
"""
import pytest
import os
@pytest.fixture(scope="session")
def figma_config():
"""Load Figma configuration from environment"""
api_key = os.environ.get('FIGMA_API_KEY')
file_key = os.environ.get('DSS_FIGMA_FILE_KEY')
if not api_key or not file_key:
pytest.skip('FIGMA_API_KEY or DSS_FIGMA_FILE_KEY not set')
return {
'api_key': api_key,
'file_key': file_key
}
@pytest.fixture
def figma_client(figma_config):
"""Initialize Figma client (mocked for now)"""
def _mock_extract_variables(file_key, format='json'):
"""Mock variable extraction"""
return {
'status': 'success',
'file_key': file_key,
'format': format,
'variables': {
'colors': {
'primary': '#0066FF',
'secondary': '#FF6B00',
'success': '#00B600',
'warning': '#FFB800',
'danger': '#FF0000',
},
'typography': {
'heading-1': {'fontSize': 32, 'fontWeight': 700},
'heading-2': {'fontSize': 24, 'fontWeight': 700},
'body': {'fontSize': 16, 'fontWeight': 400},
'caption': {'fontSize': 12, 'fontWeight': 400},
},
'spacing': {
'xs': 4,
'sm': 8,
'md': 16,
'lg': 24,
'xl': 32,
},
},
'tokens_count': 14
}
def _mock_extract_components(file_key):
"""Mock component extraction"""
return {
'status': 'success',
'file_key': file_key,
'components': {
'Button': {
'description': 'Primary action button',
'variants': ['primary', 'secondary', 'small', 'large'],
'properties': ['onClick', 'disabled', 'loading']
},
'Card': {
'description': 'Content container',
'variants': ['elevated', 'outlined'],
'properties': ['spacing', 'border']
},
'TextField': {
'description': 'Text input field',
'variants': ['default', 'error', 'disabled'],
'properties': ['placeholder', 'value', 'onChange']
},
},
'components_count': 3
}
def _mock_extract_styles(file_key):
"""Mock style extraction"""
return {
'status': 'success',
'file_key': file_key,
'styles': {
'colors': ['primary', 'secondary', 'success', 'warning', 'danger'],
'fills': ['solid-primary', 'solid-secondary', 'gradient-main'],
'typography': ['heading-1', 'heading-2', 'body', 'caption'],
'effects': ['shadow-sm', 'shadow-md', 'shadow-lg'],
},
'styles_count': 14
}
return {
'config': figma_config,
'extract_variables': _mock_extract_variables,
'extract_components': _mock_extract_components,
'extract_styles': _mock_extract_styles,
}