test_platform_access.py 985 B

12345678910111213141516171819202122232425262728293031323334
  1. from content_agent.business_modules import platform_access
  2. class DuplicateVideoClient:
  3. def search(self, query):
  4. return [
  5. {
  6. "candidate_id": f"{query['query_id']}_c_001",
  7. "query_id": query["query_id"],
  8. "aweme_id": "7601814454925298994",
  9. "desc": "重复视频",
  10. }
  11. ]
  12. def test_platform_access_deduplicates_same_aweme_across_queries():
  13. queries = [
  14. {
  15. "query_id": "q_001",
  16. "query": "基层公职人员贪腐案例",
  17. "generation_type": "item_combo",
  18. },
  19. {
  20. "query_id": "q_002",
  21. "query": "综合性腐败 警示案例",
  22. "generation_type": "light_extension",
  23. },
  24. ]
  25. results = platform_access.run(queries, DuplicateVideoClient())
  26. assert len(results) == 1
  27. assert results[0]["query_id"] == "q_001"
  28. assert results[0]["query"] == "基层公职人员贪腐案例"