| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- """§8 内容运营"""
- import pytest
- pytestmark = pytest.mark.integration
- def test_content_materials_and_plans(api, uid):
- mat = api.assert_success(
- api.post(
- "/content/materials",
- json={
- "title": f"话术{uid}",
- "type": "script",
- "content": "测试内容",
- "tags": ["pytest"],
- "creatorId": 1,
- },
- ),
- status=201,
- )
- mat_id = mat["id"]
- mats = api.assert_success(api.get("/content/materials"))
- assert any(m["id"] == mat_id for m in mats)
- plan = api.assert_success(
- api.post(
- "/content/plans",
- json={
- "name": f"计划{uid}",
- "startDate": "2026-05-25",
- "endDate": "2026-05-31",
- "ownerId": 1,
- },
- ),
- status=201,
- )
- plan_id = plan["id"]
- item = api.assert_success(
- api.post(
- f"/content/plans/{plan_id}/items",
- json={
- "planId": plan_id,
- "content": "发送预告",
- "scheduledDate": "2026-05-30",
- "targetRoomIds": ["room-1"],
- "materialId": mat_id,
- },
- ),
- status=201,
- )
- assert item["planId"] == plan_id
- items = api.assert_success(api.get(f"/content/plans/{plan_id}/items"))
- assert len(items) >= 1
- execution = api.assert_success(api.get(f"/content/plans/{plan_id}/execution"))
- assert isinstance(execution, dict)
- api.assert_success(api.delete(f"/content/materials/{mat_id}"))
|