| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- """§9 KOC 与意向客户"""
- import pytest
- pytestmark = pytest.mark.integration
- def test_channels_and_intent(api, uid):
- ch = api.assert_success(
- api.post(
- "/channels",
- json={
- "name": f"渠道{uid}",
- "code": f"ch-{uid}",
- "type": "offline",
- "remark": "pytest",
- },
- ),
- status=201,
- )
- ch_id = ch["id"]
- channels = api.assert_success(api.get("/channels"))
- assert any(c["id"] == ch_id for c in channels)
- detect = api.assert_success(
- api.post(
- "/intent-leads/detect",
- json={
- "userId": f"user-{uid}",
- "roomId": f"room-{uid}",
- "content": "这个方案多少钱?能约量房吗?",
- },
- )
- )
- assert isinstance(detect, dict)
- leads = api.assert_success(api.get("/intent-leads"))
- assert isinstance(leads, list)
- tasks = api.assert_success(api.get("/intent-tasks"))
- assert isinstance(tasks, list)
- candidates = api.assert_success(api.get("/koc/candidates"))
- assert isinstance(candidates, list)
- api.assert_success(api.delete(f"/channels/{ch_id}"))
|