fix(test-round): 测试清单一批 bug 修复 + 团队月限额持久化
后端: - accounts: 团队级月限额持久化(Team.monthly_credit_limit 三态 + PATCH/GET /api/auth/team/settings/,刷新不丢,PMC#12);头像上传 500→502 可读错误; 设备下线真失效(删并重建 token,旧 token 401) - assets: 审核类目加 model_portrait,消除三视图"无需审核"误报 - ai/projects/products: 模特已有三视图复用、产品三视图同步回商品库 (metadata.view=three_view)、真人模特三视图回写 前端: - 商品图删除判断改用真实图片数;团队成员弹窗禁点外部关闭 - 图片预览骨架铺满占位;平台套图左侧栏折叠改导航同款;收件箱长文换行对齐 - 团队月限额改真落库(乐观更新+失败回滚) 测试:新增 TeamSettingsTests(5 条),accounts 全套 36 tests 通过;前端 build 0 error Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -34,10 +34,12 @@ class Asset(TeamOwnedModel):
|
||||
FREE_CREATE = "free_create", "Free Create" # 自由创作(图片趴)
|
||||
STORYBOARD = "storyboard", "Storyboard" # 分镜图(视频趴·送审)
|
||||
|
||||
# 送审范围(火山人像审核):视频趴含人脸 = 角色定妆照 / 三视图 / 分镜图 / 场景 / 商品图。
|
||||
# 送审范围(火山人像审核):视频趴含人脸 = 角色定妆照 / 模特形象图 / 三视图 / 分镜图 / 场景 / 商品图。
|
||||
# model_portrait(模特库形象图,尤其真人上传)与 person 同样是真人脸,必须可送审——否则新增模特后在
|
||||
# 基础资产点「待审核」会被判「该素材无需审核」(ZWQ#6:AI 角色 person 可审、上传模特 model_portrait 报无需审核)。
|
||||
# 场景图与商品图也可能出现真人(模特出镜/上身),不送审则视频路只能传原始直链 → 火山判「疑似真人」拒;
|
||||
# 送审后拿到 remote_id,视频路换 asset:// 素材库引用即可放行。图片趴(上身图/套图/创作)仍不送审。
|
||||
REVIEW_CATEGORIES = ("person", "tri_view", "storyboard", "scene", "product_image")
|
||||
REVIEW_CATEGORIES = ("person", "model_portrait", "tri_view", "storyboard", "scene", "product_image")
|
||||
|
||||
name = models.CharField(max_length=255)
|
||||
asset_type = models.CharField(max_length=24, choices=Type.choices)
|
||||
|
||||
@@ -182,7 +182,8 @@ class SubmitReviewTests(TestCase):
|
||||
self.client = APIClient()
|
||||
self.client.force_authenticate(self.user)
|
||||
self.person = Asset.objects.create(team=self.team, name="角色", asset_type="image", source="ai_generated", category=Asset.Category.PERSON)
|
||||
self.product = Asset.objects.create(team=self.team, name="商品图", asset_type="image", source="upload", category=Asset.Category.PRODUCT_IMAGE)
|
||||
# 图片趴(模特上身图)= 非送审类,用于校验 submit-review 对其拒绝(product_image/scene 现已属送审类)
|
||||
self.tryon = Asset.objects.create(team=self.team, name="上身图", asset_type="image", source="ai_generated", category=Asset.Category.MODEL_TRYON)
|
||||
|
||||
def test_submit_review_person_ok(self):
|
||||
with patch("apps.assets.review.submit_asset_for_review") as sub:
|
||||
@@ -192,7 +193,7 @@ class SubmitReviewTests(TestCase):
|
||||
self.assertIn("review_status", res.json())
|
||||
|
||||
def test_submit_review_rejects_non_review_category(self):
|
||||
res = self.client.post(f"/api/assets/{self.product.id}/submit-review/")
|
||||
res = self.client.post(f"/api/assets/{self.tryon.id}/submit-review/")
|
||||
self.assertEqual(res.status_code, 400)
|
||||
|
||||
def test_submit_review_503_when_submission_did_not_start(self):
|
||||
@@ -218,22 +219,26 @@ class SubmitReviewTests(TestCase):
|
||||
|
||||
|
||||
class ReviewScopeTests(TestCase):
|
||||
"""送审范围 = 角色定妆照(person)/ 三视图(tri_view)/ 分镜图(storyboard);图片趴不送审。"""
|
||||
"""送审范围 = 含人脸资产:角色定妆照(person)/ 模特形象图(model_portrait)/ 三视图(tri_view)/
|
||||
分镜图(storyboard)/ 场景(scene)/ 商品图(product_image);图片趴(上身图/套图/创作)不送审。"""
|
||||
|
||||
def test_review_categories_constant(self):
|
||||
self.assertEqual(Asset.REVIEW_CATEGORIES, ("person", "tri_view", "storyboard"))
|
||||
self.assertEqual(
|
||||
Asset.REVIEW_CATEGORIES,
|
||||
("person", "model_portrait", "tri_view", "storyboard", "scene", "product_image"),
|
||||
)
|
||||
|
||||
def test_poll_team_reviews_only_scans_review_categories(self):
|
||||
from apps.assets import review
|
||||
|
||||
_, team = _mk_team("uc", "TeamC")
|
||||
keep = {}
|
||||
for cat in ("person", "tri_view", "storyboard"):
|
||||
for cat in ("person", "model_portrait", "tri_view", "storyboard", "scene", "product_image"):
|
||||
a = Asset.objects.create(team=team, name=cat, asset_type="image", source="ai_generated",
|
||||
category=cat, review_status="processing")
|
||||
keep[cat] = str(a.id)
|
||||
# 图片趴 / 场景:不应进送审队列
|
||||
for cat in ("model_tryon", "model_portrait", "scene"):
|
||||
# 图片趴:不应进送审队列
|
||||
for cat in ("model_tryon", "platform_kit", "free_create"):
|
||||
Asset.objects.create(team=team, name=cat, asset_type="image", source="ai_generated",
|
||||
category=cat, review_status="processing")
|
||||
with patch("apps.assets.review.assets_client.is_enabled", return_value=False):
|
||||
|
||||
Reference in New Issue
Block a user