- Replace black, isort, and flake8 with Ruff (all-in-one linter and formatter) - Add comprehensive pyproject.toml configuration - Simplify Makefile code quality targets - Configure exclusions for venv/.venv in pyproject.toml - Auto-fix 1,359 linting issues across codebase Benefits: - Much faster builds (Ruff is written in Rust) - Single tool replaces multiple tools - More comprehensive rule set (UP, B, C4, SIM, PIE, RET, Q) - All configuration centralized in pyproject.toml - Better import sorting and formatting consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
86 lines
2.0 KiB
Python
86 lines
2.0 KiB
Python
# tests/integration/middleware/conftest.py
|
|
"""
|
|
Fixtures specific to middleware integration tests.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from models.database.vendor import Vendor
|
|
from models.database.vendor_domain import VendorDomain
|
|
from models.database.vendor_theme import VendorTheme
|
|
|
|
|
|
@pytest.fixture
|
|
def vendor_with_subdomain(db):
|
|
"""Create a vendor with subdomain for testing."""
|
|
vendor = Vendor(
|
|
name="Test Vendor", code="testvendor", subdomain="testvendor", is_active=True
|
|
)
|
|
db.add(vendor)
|
|
db.commit()
|
|
db.refresh(vendor)
|
|
return vendor
|
|
|
|
|
|
@pytest.fixture
|
|
def vendor_with_custom_domain(db):
|
|
"""Create a vendor with custom domain for testing."""
|
|
vendor = Vendor(
|
|
name="Custom Domain Vendor",
|
|
code="customvendor",
|
|
subdomain="customvendor",
|
|
is_active=True,
|
|
)
|
|
db.add(vendor)
|
|
db.commit()
|
|
db.refresh(vendor)
|
|
|
|
# Add custom domain
|
|
domain = VendorDomain(
|
|
vendor_id=vendor.id, domain="customdomain.com", is_active=True, is_primary=True
|
|
)
|
|
db.add(domain)
|
|
db.commit()
|
|
|
|
return vendor
|
|
|
|
|
|
@pytest.fixture
|
|
def vendor_with_theme(db):
|
|
"""Create a vendor with custom theme for testing."""
|
|
vendor = Vendor(
|
|
name="Themed Vendor",
|
|
code="themedvendor",
|
|
subdomain="themedvendor",
|
|
is_active=True,
|
|
)
|
|
db.add(vendor)
|
|
db.commit()
|
|
db.refresh(vendor)
|
|
|
|
# Add custom theme
|
|
theme = VendorTheme(
|
|
vendor_id=vendor.id,
|
|
primary_color="#FF5733",
|
|
secondary_color="#33FF57",
|
|
logo_url="/static/vendors/themedvendor/logo.png",
|
|
favicon_url="/static/vendors/themedvendor/favicon.ico",
|
|
custom_css="body { background: #FF5733; }",
|
|
)
|
|
db.add(theme)
|
|
db.commit()
|
|
|
|
return vendor
|
|
|
|
|
|
@pytest.fixture
|
|
def inactive_vendor(db):
|
|
"""Create an inactive vendor for testing."""
|
|
vendor = Vendor(
|
|
name="Inactive Vendor", code="inactive", subdomain="inactive", is_active=False
|
|
)
|
|
db.add(vendor)
|
|
db.commit()
|
|
db.refresh(vendor)
|
|
return vendor
|