Commit 9dd8506d authored by 张淑琴's avatar 张淑琴

未读消息数

parent c9eb2e34
import path_setting
from in_common.base_request import BaseRequest
class notification_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.UNREAD_CONFIG)
def unread(self,uqid,trace_id,):
self.params["uqid"] = uqid
self.params["trace_id"] = trace_id
return self.api_send(self.data["unread"])
if __name__ == '__main__':
print(notification_request().unread("1B519701-A4F5-453E-9D99-140B5AF697A0", "2021/04/22/1722/46cf97b999b0"))
unread:
method: get
url: /api/notification/unread
params:
uqid: ${uqid}
trace_id: ${trace_id}
data: {}
json: {}
isLogin: 1 #需要登录的接口
......@@ -79,6 +79,10 @@ MESSAGE_READ = os.path.join(BASE_DIR, "backend_auto/test_backend_data/conversati
CONVERSATION_DETAIL_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "im_request.yaml")
CONVERSATION_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/im_data", "conversation_detail.yaml")
#消息页未读数
UNREAD_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "notification_request.yaml")
UNREAD = os.path.join(BASE_DIR, "backend_auto/test_backend_data/notification_data", "unread.yaml")
if __name__ == '__main__':
print("==========",LIVEYAML_CONFIG)
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.notification_request import notification_request
class TestUnread:
data = BaseRequest().api_load(path_setting.UNREAD)
unread_case, unread_data = get_ids(data, "unread")
@pytest.mark.parametrize("param",unread_data,ids=unread_case)
def test_unread(self,param):
r = notification_request().unread(param["uqid"], param["trace_id"])
#print("返回结果是:%s" % r)
total_count = r["data"]["unread_count"]["total_count"]
print("总数量是:%s" % total_count)
total_unread = r.get("data").get("unread_count").get("follow_count").get("total_unread")#关注总未读数
#print("总数量1是:%s" % total_unread)
message_count = r["data"]["unread_count"]["message_count"]#私信列表总未读数
#print("私信列表总未读数是:%s" % message_count)
vote_favor = r["data"]["unread_count"]["vote_favor_count"]["vote_favor"]#赞/收藏总未读数
#print("赞/收藏总未读数是:%s" % vote_favor)
reply_count = r["data"]["unread_count"]["reply_count"] #回复总未读数
#print("回复总未读数是:%s" % reply_count)
count = total_unread + message_count + vote_favor + reply_count
#print("相加总数是是:%s" % count)
if r["error"] == 0:
assert r["data"]["unread_count"]["total_count"] >= param["assert"]
assert r["data"]["unread_count"]["total_count"] == count
unread:
#验证成功case
-
case: "请求成功,消息页各icon未读消息数等于总数"
uqid: "1B519701-A4F5-453E-9D99-140B5AF697A0"
trace_id: "2021/04/22/1722/46cf97b999b0"
#total_count:
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