|
@@ -1,4 +1,5 @@
|
|
|
import json
|
|
|
+import unittest
|
|
|
|
|
|
import requests
|
|
|
|
|
@@ -11,7 +12,7 @@ def print_json_plain(obj):
|
|
|
print(json.dumps(obj, ensure_ascii=False))
|
|
|
|
|
|
|
|
|
-def test(user_id, product, effect):
|
|
|
+def req(user_id, product, effect):
|
|
|
base_url = 'https://escrow.gateway.k8s-nb.intra.mlamp.cn/92pq4p3461/api/hao_rec/inner/bot'
|
|
|
params = {"user_id": user_id, "product": product, "effect": effect}
|
|
|
res = requests.get(base_url, params=params)
|
|
@@ -20,4 +21,17 @@ def test(user_id, product, effect):
|
|
|
print_json_pretty(res.json())
|
|
|
|
|
|
|
|
|
-test(1, '眼霜', '修护')
|
|
|
+class MyTest(unittest.TestCase):
|
|
|
+ # 测试价格
|
|
|
+ def test1(self):
|
|
|
+ req(1, '眼霜', '修护')
|
|
|
+ req(1, '', '便宜')
|
|
|
+
|
|
|
+ # 测试死锁
|
|
|
+ def test2(self):
|
|
|
+ req(1, '粉底液', '祛痘')
|
|
|
+ req(1, '眼霜', '修护')
|
|
|
+
|
|
|
+ # 测试兜底策略
|
|
|
+ def test3(self):
|
|
|
+ req(1, '', '')
|