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:
zyc
2026-06-29 18:50:22 +08:00
co-authored by Claude Opus 4.8
parent ca0c3e2300
commit b0b3ac2348
20 changed files with 476 additions and 57 deletions
+12 -7
View File
@@ -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):