Commit 3ea11998 authored by 张伟男's avatar 张伟男

Merge branch 'common_dev' into zwn_dev

parents 643d4b89 1c6a21d0
from backend_auto import path_setting
from backend_auto.in_common.base_request import BaseRequest
import path_setting
from in_common.base_request import BaseRequest
class diary_data_reqest(BaseRequest):
......
......@@ -10,7 +10,12 @@ class notification_request(BaseRequest):
self.params["uqid"] = uqid
self.params["trace_id"] = trace_id
return self.api_send(self.data["unread"])
def readall(self,uqid,trace_id,ua):
self.params["uqid"] = uqid
self.params["trace_id"] = trace_id
self.params["ua"] = ua
return self.api_send(self.data["readall"])
if __name__ == '__main__':
print(notification_request().unread("1B519701-A4F5-453E-9D99-140B5AF697A0", "2021/04/22/1722/46cf97b999b0"))
#print(notification_request().unread("1B519701-A4F5-453E-9D99-140B5AF697A0", "2021/04/22/1722/46cf97b999b0"))
print(notification_request().readall("1B519701-A4F5-453E-9D99-140B5AF697A0", "2021/05/19/1526/19fcd4c4be47","Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"))
#未读消息数
unread:
method: get
url: /api/notification/unread
......@@ -9,3 +10,15 @@ unread:
json: {}
isLogin: 1 #需要登录的接口
#标记为已读
readall:
method: post
url: /api/notification/readall
params:
uqid: ${uqid}
trace_id: ${trace_id}
ua: ${ua}
data: {}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
......@@ -5,7 +5,7 @@ from in_common.base_request import BaseRequest
class service_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOME_V5_CONFIG)
self.data = self.api_load(path_setting.HOME_V5_CONFIG) #/all_backend_api/service_request.yaml
def home_v5(self):
......
......@@ -4,6 +4,16 @@ from in_common.base_request import BaseRequest
class user_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.PERSONAL_CENTER_CONFIG)
def personal_center(self):
print("fgx")
return self.api_send(self.data["personal_center"])
def __init__(self):
self.data = self.api_load(path_setting.USER_ANSWER_CONFIG)
......@@ -14,5 +24,11 @@ class user_request(BaseRequest):
if __name__ == '__main__':
#个人中心
print(user_request().personal_center())
print("fgx")
#打印医生/医院主页问答列表接口返回
print(user_request().answer("21476198"))
\ No newline at end of file
print(user_request().answer("21476198"))
personal_center:
method: GET
url: /api/user/personal_center
params:
choose_id: 0
community_id: 0
version: 7.42.0
data: {}
json: {}
isLogin: 1
#医院主页-问答接口
answer:
method: get
......@@ -7,4 +18,5 @@ answer:
count: 10
page: 1
data: {}
json: {}
\ No newline at end of file
json: {}
develop_host:
backend: http://backend.paas-develop.env
# doctor: http://doctor.paas-develop.env
doctor: http://doctor.paas-develop.env
......@@ -63,11 +63,20 @@ class BaseRequest:
def api_send(self, req: dict):
host = self.api_load(path_setting.HOSTYAML_CONFIG)
url_host = ""
if host["develop_host"].get("doctor") is not None:
url_host = host['develop_host']['doctor']
elif host["develop_host"].get("backend") is not None:
url_host = host['develop_host']['backend']
# 获取调用该方法的路径
import inspect
ins_file = inspect.stack()[1].filename
ins_dir = ins_file.split('/')[-2]
host_service = ins_dir.split('_')[1]
# default: backend
if host_service not in host['develop_host']:
host_service = 'backend'
url_host = host['develop_host'][host_service]
# if host["develop_host"].get("doctor") is not None:
# url_host = host['develop_host']['doctor']
# elif host["develop_host"].get("backend") is not None:
# url_host = host['develop_host']['backend']
raw = yaml.dump(req) # 将一个python对象生成为yaml文档
for key, value in self.params.items():
......
......@@ -103,6 +103,8 @@ MY_CONVERSATION = os.path.join(BASE_DIR, "backend_auto/test_backend_data/my_conv
HOME_V5_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "service_request.yaml")
HOME_V5=os.path.join(BASE_DIR,"backend_auto/test_backend_data/service_data","home_v5.yaml")
PERSONAL_CENTER_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "user_request.yaml")
PERSONAL_CENTER = os.path.join(BASE_DIR, "backend_auto/test_backend_data/user_data", "personal_center.yaml")
#搜索结果页-综合/百科
CONTENTV7_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
......@@ -130,7 +132,8 @@ AUTO_MSG = os.path.join(BASE_DIR, "backend_auto/test_backend_data/im_data", "aut
#消息页未读数
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")
#标记为已读
READALL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/notification_data", "readall.yaml")
if __name__ == '__main__':
......
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 TestReadall:
data = BaseRequest().api_load(path_setting.READALL)
readall_case, readall_data = get_ids(data, "readall")
@pytest.mark.parametrize("param",readall_data,ids=readall_case)
def test_readall(self,param):
r = notification_request().readall(param["uqid"], param["trace_id"],param["ua"])
print(r)
assert r["error"] == 0
\ No newline at end of file
......@@ -9,13 +9,13 @@ from all_backend_api.service_request import service_request
class TestHomeV5:
data = BaseRequest().api_load(path_setting.HOME_V5)
homev5_case, homev5_data = get_ids(data, "home_v5")
print(data)
@pytest.mark.parametrize("param",homev5_data,ids=homev5_case)
def test_home_v5(self,param):
#print(param["home_v5"])
r = service_request().home_v5()
print(r)
print("home_v6")
#if r["error"] == 0:
assert r["error"] == param["assert"]
......
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.user_request import user_request
class TestPersonalCenter:
data = BaseRequest().api_load(path_setting.PERSONAL_CENTER)
personalcenter_case, personalcenter_data = get_ids(data, "personal_center")
@pytest.mark.parametrize("param", personalcenter_data, ids=personalcenter_case)
def test_personal_center(self, param):
r = user_request().personal_center()
print('feng=', r)
if r["error"] == 0:
assert r["error"] == param["assert"]
assert r["data"]["user"]["portrait"] != param["portrait"]
readall:
#验证成功case
-
case: "标记为已读成功"
uqid: "1B519701-A4F5-453E-9D99-140B5AF697A0"
trace_id: "2021/05/19/1526/19fcd4c4be47"
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
assert: 0
\ No newline at end of file
home_v5:
#获取商城首页
-
case: "获取商城首页--case首页"
case: "获取商城首页index--case首页"
assert: 0
......
personal_center:
#个人中心
-
case: "获取个人中心--case首页"
assert: 0
portrait: null
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