Commit 8b575b7b authored by 林颖's avatar 林颖

修改日记本--美购相关

parent 882befc4
......@@ -14,7 +14,7 @@ class diary_request(BaseRequest):
def diary_cancelfavor(self):
return self.api_send(self.data["cancelfavor"])
# 更新日记本 无权限
# 更新日记本信息
def diary_operation(self, diary_id, title, operation_timestamp, doctor_name, hospital_name):
self.params["diary_id"] = diary_id
self.params["title"] = title
......
......@@ -7,36 +7,25 @@ from all_backend_api.diary_request import diary_request
class TestDiaryService:
data = BaseRequest().api_load(path_setting.DIARY_DATA)
diary_data_case, diary_data_data = get_ids(data, "diary_data")
data = BaseRequest().api_load(path_setting.DIARY_SERVICE)
diary_service_case, diary_service_data = get_ids(data, "diary_service")
@pytest.mark.parametrize("param",diary_data_data,ids=diary_data_case)
def test_diary_service(self,param):
@pytest.mark.parametrize("param", diary_service_data,ids=diary_service_case)
def test_diary_service(self, param):
# print(2)
r = diary_request().diary_data(param["current_city_id"], param["diary_referrer"], param["sort"], param["count"], param["start_num"])
r = diary_request().diary_service( param["diary_id"], param["service_id"])
# print(r)
if r["error"] == 0:
assert r["error"] == param["assert"]
# 先判断有没有日记,然后判断日记本里面需要的那些字段,如点赞字段,日记总数等,不传值,传空值
if r["data"]:
assert r["data"][0]["post_date"] is not None and r["data"][0]["post_date"] is not "" #c创建时间
assert r["data"][0]["diary_num"] is not None and r["data"][0]["diary_num"] is not "" #日记总数
assert r["data"][0]["view_count"] is not None and r["data"][0]["view_count"] is not "" #浏览次数
assert r["data"][0]["is_liked"] is not None and r["data"][0]["is_liked"] is not "" #是否点赞
assert r["data"][0]["operation_day"] is not None and r["data"][0]["operation_day"] is not "" #术后多少天
assert r["data"][0]["vote_count"] is not None and r["data"][0]["vote_count"] is not "" #点赞总数
assert r["data"][0]["reply_count"] is not None and r["data"][0]["reply_count"] is not ""#评论总数
assert r["data"][0]["id"] is not None and r["data"][0]["id"] is not ""#日记贴id
# 判断评论列表里面的用户信息是否为空,先判断有没有评论
if r["data"][0]["comments"]:
assert r["data"][0]["comments"][0]["user_id"] is not None and r["data"][0]["comments"][0]["user_id"] is not ""#用户id
assert r["data"][0]["comments"][0]["nick_name"] is not None and r["data"][0]["comments"][0]["nick_name"] is not ""#用户名
assert r["data"][0]["comments"][0]["gm_url"] is not None and r["data"][0]["comments"][0]["gm_url"] is not ""#点击头像跳转链接
# assert(r[""])
if r["error"] == 1:
assert r["error"] == param["assert"]
# 先判断有没有美购的字段,没有就检验接口就行,然后判断接口里面需要的那些字段是否不传值,传空值
if r["data"]["service_data"]:
assert r["data"]["service_data"]["gengmei_price"] is not None and r["data"]["service_data"]["gengmei_price"] is not "" # 更美价
assert r["data"]["service_data"]["service_name"] is not None and r["data"]["service_data"]["service_name"] is not "" # 美购名称
assert r["data"]["service_data"]["gm_url"] is not None and r["data"]["service_data"]["gm_url"] is not "" # 跳转链接
assert r["data"]["service_data"]["is_seckill"] is not None and r["data"]["service_data"]["is_seckill"] is not "" # 是否秒杀
......
diary_service:
#字段正常case
-
case: "有推荐美购的日记--有外显评论"
diary_id: ""
service_id: 5815774
case: "有推荐美购的日记"
diary_id: 17586147
service_id: 5878139
assert: 0
-
case: "接口传参数失败,但不报错case"
current_city_id: "beijing"
diary_referrer: "my_diary"
sort: 0
count: 8
start_num: 2
case: "已下线的推荐美购的日记"
diary_id: 17586094
service_id: 5885050
assert: 0
- case: "没有推荐美购的日记"
diary_id: 17586140
service_id:
assert: 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment