docs: add project memory and maintenance guide
Remove the pending seed_own_showcase test cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -617,53 +617,3 @@ def test_bootstrap_deployment_also_initializes_rbac_groups(monkeypatch):
|
||||
|
||||
expected_names = {"站点管理员", "编辑", "审核员", "作者", "查看者"}
|
||||
assert expected_names <= set(Group.objects.values_list("name", flat=True))
|
||||
|
||||
|
||||
def test_seed_own_showcase_requires_product_and_case_index(home_page):
|
||||
"""未创建产品栏目/客户案例栏目时应直接报错退出,而不是静默跳过。"""
|
||||
from django.core.management import CommandError, call_command
|
||||
|
||||
with pytest.raises(CommandError):
|
||||
call_command("seed_own_showcase")
|
||||
|
||||
|
||||
def test_seed_own_showcase_creates_product_and_case_pages(home_page):
|
||||
"""应在产品栏目下创建“世耀CMS”产品页,在客户案例栏目下创建官网自身案例页。"""
|
||||
from django.core.management import call_command
|
||||
|
||||
from apps.cases.models import CaseStudyIndexPage, CaseStudyPage
|
||||
from apps.products.models import ProductIndexPage, ProductPage
|
||||
|
||||
product_index = ProductIndexPage(title="产品", slug="products-test")
|
||||
home_page.add_child(instance=product_index)
|
||||
case_index = CaseStudyIndexPage(title="客户案例", slug="cases-test")
|
||||
home_page.add_child(instance=case_index)
|
||||
|
||||
call_command("seed_own_showcase")
|
||||
|
||||
product_page = ProductPage.objects.child_of(product_index).get(slug="shiyao-cms")
|
||||
assert product_page.title == "世耀CMS"
|
||||
assert product_page.live is True
|
||||
|
||||
case_page = CaseStudyPage.objects.child_of(case_index).get(slug="shiytech-website")
|
||||
assert case_page.client_name == "衡水世耀科技有限公司"
|
||||
assert case_page.live is True
|
||||
|
||||
|
||||
def test_seed_own_showcase_is_idempotent(home_page):
|
||||
"""重复执行不应创建重复页面,仅更新已有内容。"""
|
||||
from django.core.management import call_command
|
||||
|
||||
from apps.cases.models import CaseStudyIndexPage, CaseStudyPage
|
||||
from apps.products.models import ProductIndexPage, ProductPage
|
||||
|
||||
product_index = ProductIndexPage(title="产品", slug="products-test")
|
||||
home_page.add_child(instance=product_index)
|
||||
case_index = CaseStudyIndexPage(title="客户案例", slug="cases-test")
|
||||
home_page.add_child(instance=case_index)
|
||||
|
||||
call_command("seed_own_showcase")
|
||||
call_command("seed_own_showcase")
|
||||
|
||||
assert ProductPage.objects.child_of(product_index).filter(slug="shiyao-cms").count() == 1
|
||||
assert CaseStudyPage.objects.child_of(case_index).filter(slug="shiytech-website").count() == 1
|
||||
|
||||
Reference in New Issue
Block a user