- apps/solutions: SolutionIndexPage/SolutionPage (mirrors products/cases) - apps/home: HomePage.subpage_types now includes products/solutions/cases index pages (previously only blog, blocking admin page creation) - pytest.ini + conftest.py (root_page/home_page fixtures) - unit tests for core (SEOablePage, FormBlock API repr), products, cases, forms (lead submit API)
20 lines
450 B
Python
20 lines
450 B
Python
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def root_page():
|
|
"""Wagtail 初始迁移创建的树根页面(depth=1)。"""
|
|
from wagtail.models import Page
|
|
|
|
return Page.objects.get(depth=1)
|
|
|
|
|
|
@pytest.fixture
|
|
def home_page(root_page):
|
|
"""在树根下创建一个测试用 HomePage 实例。"""
|
|
from apps.home.models import HomePage
|
|
|
|
page = HomePage(title="首页", slug="home-test")
|
|
root_page.add_child(instance=page)
|
|
return page
|