Commit 7de260ff authored by edz's avatar edz

Merge branch 'common_dev' into cx_dev

parents c135be8d bde756a2
No preview for this file type
...@@ -9,5 +9,6 @@ login_vfc: ...@@ -9,5 +9,6 @@ login_vfc:
vfc_type: ${vfc_type} vfc_type: ${vfc_type}
face_token: ${face_token} face_token: ${face_token}
json: {} json: {}
isLogin: 1 #需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
import path_setting
from in_common.base_request import BaseRequest
class conversation_request(BaseRequest):
def __init__(self):
self.messageread = self.api_load(path_setting.MESSAGE_READ_CONFIG)
def message_read(self,current_city_id,release,message_ids):
self.params["current_city_id"] = current_city_id
self.params["release"] = release
#self.params["uqid"] = uqid
self.params["message_ids"] = message_ids
return self.api_send(self.messageread["message_read"])
if __name__ == '__main__':
print(conversation_request().message_read("beijing", 1,'[10622,10626,10646,10651]'))
message_read:
method: post
url: /api/conversation/message/read
params:
current_city_id: ${current_city_id}
release: ${release}
#uqid: ${uqid}
data:
message_ids: ${message_ids}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
from backend_auto import path_setting import path_setting
from backend_auto.in_common.base_request import BaseRequest from in_common.base_request import BaseRequest
class diary_data_reqest(BaseRequest): class diary_data_reqest(BaseRequest):
......
import path_setting
from in_common.base_request import BaseRequest
class doctor_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.DOCTOR_ARTICLE_CONFIG)
#医生/医院主页-医生说/医院说列表
def article(self, doctor_id):
self.params["doctor_id"] = doctor_id
return self.api_send(self.data["article"])
#医生主页详情
def detail(self):
return self.api_send(self.data["detail"])
#医生主页案例列表
def diary(self, doctor_id):
self.params["doctor_id"] = doctor_id
return self.api_send(self.data["diary"])
if __name__ == '__main__':
#打印医生/医院主页-医生说/医院说列表接口返回
print(doctor_request().article("9918ad7eb8f511e58f8200163e000a4a"))
#打印医生主页详情接口返回
print(doctor_request.detail())
#打印医生主页案例列表接口返回
print(doctor_request.diary("5bd9f05cad51403d853ba8c881989e23"))
\ No newline at end of file
#医生/医院主页——医生说/医院说
article:
method: get
url: /api/doctor/article
params:
doctor_id: ${doctor_id}
count: 10
page: 1
own_page: 0
doctor_type: 0
data: {}
json: {}
#医生主页详情
detail:
method: get
url: /api/doctor/5bd9f05cad51403d853ba8c881989e23/detail
params: {}
data: {}
json: {}
#医生主页案例列表
diary:
method: get
url: /api/doctor/diary
params:
doctor_id: ${doctor_id}
count: 4
page: 1
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class doctor_v2_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.DOCTOR_V2_CONFIG)
#医生主页商品列表
def services(self):
return self.api_send(self.data["services"])
if __name__ == '__main__':
#打印医生主页商品列表接口返回
print(doctor_v2_request().services())
\ No newline at end of file
#医生主页商品列表
services:
method: get
url: /api/doctor_v2/5bd9f05cad51403d853ba8c881989e23/services
params:
offset: 0
show_tag_distro: 1
tag_id: all
size: 10
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class gmai_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.GMAI_SKIN_NEWREPORT_CONFIG)
# 测颜值结果页
def skin_newReport(self,version,image_url):
self.params["version"] = version
self.params["image_url"] = image_url
return self.api_send(self.data["skin_newReport"])
# 模拟双眼皮
def eyelids_plastic(self,version,image_url,style_id):
self.params["version"] = version
self.params["image_url"] = image_url
self.params["style_id"] = style_id
return self.api_send(self.data["eyelids_plastic"])
# 模拟发型
def simulate_analyze(self,device_id,image_url,style_id,type_id):
self.params["device_id"] = device_id
self.params["image_url"] = image_url
self.params["style_id"] = style_id
self.params["type_id"] = type_id
return self.api_send(self.data["simulate_analyze"])
# AI测颜值
def plastic_analysis_v3(self,device_id,image_url,landmark,cheek_style_classify_id):
self.params["device_id"] = device_id
self.params["image_url"] = image_url
self.params["landmark"] = landmark
self.params["cheek_style_classify_id"] = cheek_style_classify_id
return self.api_send(self.data["analysis_v3"])
if __name__ == '__main__':
print(gmai_request().simulate_analyze("869412032478155","2021/06/02/1456/68c702f50309","3","7"))
# landmark = '[{"x":248.60858,"y":454.0434},{"x":247.92863,"y":476.7021},{"x":248.8779,"y":499.36874},{"x":251.12755,"y":521.8638},{"x":254.58401,"y":544.24164},{"x":259.10333,"y":566.1669},{"x":264.02515,"y":588.0588},{"x":270.59506,"y":609.44214},{"x":279.6361,"y":629.6998},{"x":291.60773,"y":648.29407},{"x":305.6806,"y":665.26465},{"x":321.33615,"y":680.4736},{"x":338.2943,"y":694.64526},{"x":356.13144,"y":707.5386},{"x":375.71283,"y":717.8617},{"x":397.27545,"y":724.19965},{"x":419.9613,"y":726.1914},{"x":441.62817,"y":725.2733},{"x":462.6242,"y":719.917},{"x":481.41635,"y":710.3818},{"x":498.45187,"y":697.98035},{"x":514.59436,"y":684.40234},{"x":529.7782,"y":669.4685},{"x":543.08704,"y":653.1195},{"x":554.60706,"y":635.73456},{"x":563.3266,"y":617.3142},{"x":570.0075,"y":596.0911},{"x":575.7123,"y":574.78046},{"x":581.05774,"y":554.0385},{"x":585.48157,"y":533.1105},{"x":588.66907,"y":512.06683},{"x":590.4706,"y":490.68823},{"x":591.2653,"y":469.50403},{"x":279.37485,"y":410.2143},{"x":299.98352,"y":383.6742},{"x":331.64465,"y":375.0197},{"x":364.35858,"y":381.4741},{"x":395.4406,"y":394.20447},{"x":466.45248,"y":397.95},{"x":496.4015,"y":389.2094},{"x":527.33295,"y":386.7473},{"x":555.7313,"y":398.20285},{"x":571.48254,"y":425.62354},{"x":427.4568,"y":456.95285},{"x":426.77496,"y":483.84033},{"x":426.04883,"y":510.83325},{"x":425.32236,"y":537.75256},{"x":385.83856,"y":572.9858},{"x":403.71045,"y":573.0551},{"x":423.23145,"y":574.53534},{"x":442.28857,"y":574.4508},{"x":459.13876,"y":574.9396},{"x":307.80756,"y":458.6329},{"x":323.8154,"y":450.41855},{"x":359.07312,"y":453.8022},{"x":371.75238,"y":466.2728},{"x":355.36838,"y":470.9956},{"x":321.71375,"y":468.2021},{"x":479.14362,"y":470.68353},{"x":492.57837,"y":459.77023},{"x":526.78955,"y":459.34094},{"x":540.76917,"y":469.22626},{"x":526.91675,"y":477.2774},{"x":494.3828,"y":476.6469},{"x":307.39963,"y":402.42038},{"x":336.54358,"y":400.2494},{"x":365.31128,"y":405.05597},{"x":393.4093,"y":412.95276},{"x":466.55408,"y":416.23398},{"x":493.2259,"y":412.04782},{"x":520.28235,"y":410.81372},{"x":546.7446,"y":415.7663},{"x":341.78073,"y":449.21838},{"x":338.20166,"y":471.98853},{"x":342.39044,"y":460.15692},{"x":509.66327,"y":456.7909},{"x":510.57373,"y":479.22314},{"x":508.77704,"y":467.26038},{"x":399.44565,"y":461.61548},{"x":453.4572,"y":463.86423},{"x":384.4139,"y":527.5456},{"x":463.68613,"y":530.3157},{"x":369.6485,"y":554.5674},{"x":475.98178,"y":558.04224},{"x":358.72372,"y":632.25916},{"x":379.92645,"y":612.99927},{"x":406.5278,"y":600.8932},{"x":422.78525,"y":604.4064},{"x":439.0467,"y":601.5054},{"x":463.0918,"y":613.59924},{"x":480.34888,"y":633.28406},{"x":463.28207,"y":645.23676},{"x":442.62195,"y":651.3627},{"x":420.9704,"y":652.71295},{"x":398.036,"y":651.2082},{"x":376.4565,"y":644.82745},{"x":363.59555,"y":631.5963},{"x":392.39032,"y":626.09314},{"x":422.20786,"y":626.16754},{"x":449.31833,"y":626.3133},{"x":475.72333,"y":632.3503},{"x":448.87988,"y":625.9888},{"x":421.7511,"y":626.1827},{"x":392.28534,"y":625.9193},{"x":342.4176,"y":460.03064},{"x":508.8405,"y":467.07236}]'
# 测颜值和 上次结果
# print(gmai_request().plastic_analysis_v3("869412032478155", "2021/06/01/1524/8a28dd0a3b8e",landmark,1))
# print(gmai_request().plastic_analysis_v3("869412032478155", "", "", 1))
# print(gmai_request().skin_newReport("7.43.0","https://pic.igengmei.com/2021/05/11/1440/25e4bf45673f-s"))
# print(gmai_request().eyelids_plastic("7.43.0", "2021/05/12/1457/cdbe8652117d","3"))
skin_newReport:
method: post
url: /gm_ai/skin/new_report
params:
version: ${version}
data:
image_url: ${image_url}
eyelids_plastic:
method: post
url: /gm_ai/eyelids/plastic
params:
version: ${version}
data:
image_url: ${image_url}
style_id: ${style_id}
analysis_v3:
method: post
url: /gm_ai/plastic/analysis_v3
params:
device_id: ${device_id}
data:
image_url: ${image_url}
landmark: ${landmark}
cheek_style_classify_id: ${cheek_style_classify_id}
simulate_analyze:
method: post
url: /gm_ai/simulate/analyze
params:
device_id: ${device_id}
data:
image_url: ${image_url}
style_id: ${style_id}
type_id: ${type_id}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class hospital_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOSPITAL_DIARY_CONFIG)
#医院主页日记列表
def diary(self, hospital):
self.params["hospital"] = hospital
return self.api_send(self.data["diary"])
if __name__ == '__main__':
#打印医院主页日记列表接口返回
print(hospital_request().diary("bjxyjcpfbyy"))
\ No newline at end of file
#医院主页日记列表
diary:
method: get
url: /api/hospital/diary
params:
hospital: ${hospital}
count: 4
page: 1
own_page: 0
tag_id:
data: {}
json: {}
\ No newline at end of file
#详情 #医院主页详情
detail: detail:
method: get method: get
url: /api/hospitals/bjxyjcpfbyy/detail url: /api/hospitals/bjxyjcpfbyy/detail
...@@ -6,7 +6,7 @@ detail: ...@@ -6,7 +6,7 @@ detail:
data: {} data: {}
json: {} json: {}
#医生列表 #医院主页医生列表
doctor: doctor:
method: get method: get
url: /api/hospitals/bjxyjcpfbyy/doctors url: /api/hospitals/bjxyjcpfbyy/doctors
......
import path_setting
from in_common.base_request import BaseRequest
class hospitals_v2_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOSPITAL_SERVICE_CONFIG)
#医院主页商品列表
def services(self):
return self.api_send(self.data["services"])
if __name__ == '__main__':
#打印医院主页商品列表接口返回
print(hospitals_v2_request().services())
\ No newline at end of file
#医院主页商品列表
services:
method: get
url: /api/hospitals_v2/bjxyjcpfbyy/services
params:
offset: 0
show_tag_distro: 1
tag_id: "all"
size: 10
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class im_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.CONVERSATION_DETAIL_CONFIG)
def conversation_detail(self,current_city_id,begin_msg_id,conversation_type,end_msg_id,referrer):
self.params["current_city_id"] = current_city_id
self.params["begin_msg_id"] = begin_msg_id
self.params["conversation_type"] = conversation_type
self.params["end_msg_id"] = end_msg_id
self.params["referrer"] = referrer
return self.api_send(self.data["conversation_detail"])
def auto_msg(self,version,uqid,trace_id,conversation_id):
self.params["version"] = version
self.params["uqid"] = uqid
self.params["trace_id"] = trace_id
self.params["conversation_id"] = conversation_id
return self.api_send(self.data["auto_msg"])
if __name__ == '__main__':
print(im_request().conversation_detail("beijing", 0, 4, 0, "message_home"))
print("第二个接口")
print(im_request().auto_msg("7.42.2","1B519701-A4F5-453E-9D99-140B5AF697A0","2021/04/22/1722/70a1791606d5",368))
conversation_detail:
method: get
url: /api/im/conversation/detail
params:
current_city_id: ${current_city_id}
begin_msg_id: ${begin_msg_id}
conversation_type: ${conversation_type}
end_msg_id: ${begin_msg_id}
referrer: ${referrer}
data: {}
json: {}
isLogin: 1 #需要登录的接口
auto_msg:
method: post
url: /api/im/auto_msg
params:
version: ${version}
trace_id: ${trace_id}
uqidd: ${uqid}
data:
conversation_id: ${conversation_id}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class janus_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.CONTENTV7_CONFIG)
self.data = self.api_load(path_setting.HOSPITALSEARCH_CONFIG)
#品类聚合页面商品列表
self.data = self.api_load(path_setting.TAG_SERVICE_CONFIG)
#搜索结果页-综合/百科tab
def content_v7(self, query, device_id, current_city_id, version, is_first, tab_type, offset):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#是否为第一次请求
self.params['is_first'] = is_first
#类型
self.params['tab_type'] = tab_type
#请求的页数 0,10,20
self.params['offset'] = offset
return self.api_send(self.data['content_v7'])
#医院主页搜索
def hospital_search(self, query, device_id, hospital_id, current_city_id, version, offset):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#医院id
self.params['hospital_id'] = hospital_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#请求的页数 0,10,20
self.params['offset'] = offset
return self.api_send(self.data['hospital_search'])
#购物车-猜你喜欢列表
def mine_guess_you_like(self):
return self.api_send(self.data["mine_guess_you_like"])
#商祥页-详情
def product_detail(self, service_id, service_item_id, version):
self.params["service_id"] = service_id
self.params["service_item_id"] = service_item_id
self.params["version"] = version
return self.api_send(self.data["product_detail"])
#商祥页-sku信息
def sku_info(self, service_id, service_item_id):
self.params["service_id"] = service_id
self.params["service_item_id"] = service_item_id
return self.api_send(self.data["sku_info"])
# 品类聚合页面商品列表
def tag_service(self, size, tag_ids, offset, tag_id, version, device_id):
print("fgx")
self.params['size'] = size
self.params['tag_ids'] = tag_ids
self.params['offset'] = offset
self.params['tag_id'] = tag_id
self.params['version'] = version
self.params['device_id'] = device_id
return self.api_send(self.data["tag_service"])
if __name__ == '__main__':
#打印购物车-猜你喜欢列表接口返回
print(janus_request().mine_guess_you_like())
#打印商祥页-详情接口返回
print(janus_request().product_detail("5857263", "618788", "7.43.0"))
#打印商祥页-sku信息接口返回
print(janus_request().sku_info("5857263", "618788"))
#品类聚合页面商品列表接口返回
print(janus_request().tag_service())
print("fgx")
content_v7:
method : get
url : /api/janus/search/v7/content
params :
query: ${query}
device_id: ${device_id}
current_city_id: ${current_city_id}
version: ${version}
is_first: ${is_first}
tab_type: ${tab_type}
offset: ${offset}
data: {}
json: {}
hospital_search:
method: get
url: /api/janus/search/hospital_search
params:
query: ${query}
device_id: ${device_id}
hospital_id: ${hospital_id}
current_city_id: ${current_city_id}
version: ${version}
offset: ${offset}
data: { }
json: { }
#购物车-猜你喜欢
mine_guess_you_like:
method: get
url: /api/janus/product/mine_guess_you_like
params: {}
data: {}
json: {}
isLogin: 1
#商祥页-详情
product_detail:
method: get
url: /api/janus/product/detail
params:
service_id: ${service_id}
service_item_id: ${service_item_id}
version: ${version}
data: {}
json: {}
#商祥页-sku信息
sku_info:
method: get
url: /api/janus/product/detail/sku_info
params:
service_id: ${service_id}
service_item_id: ${service_item_id}
data: {}
json: {}
#品类聚合页面商品列表的
tag_service:
method: GET
url: /api/janus/product/tag_service
params:
size: ${size}
tag_ids: ${tag_ids}
offset: ${offset}
tag_id: ${tag_id}
version: ${version}
device_id: ${device_id}
data: { }
json: { }
import path_setting
from in_common.base_request import BaseRequest
class living_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.LIVEYAML_CONFIG)
#获取弹幕
def danmu_v2(self,channel_id,msg_id,user_id=""):
self.params["channel_id"] = channel_id
self.params["msg_id"] = msg_id
self.params["user_id"] = user_id
return self.api_send(self.data["danmu_v2"])
#主播开播
def pushlive_info(self,title,cover_url,notice,tag_id,clarity,device_type):
self.params["title"] = title
self.params["cover_url"] = cover_url
self.params["notice"] = notice
self.params["tag_id"] = tag_id
self.params["clarity"] = clarity
self.params["device_type"] = device_type
return self.api_send(self.data["pushlive_info"])
if __name__ == '__main__':
(living_request().danmu_v2("739", "1"))
(living_request().pushlive_info("小冤家", "2021/04/22/1003/cef471cff5e6", "", "1", "1", "1"))
\ No newline at end of file
#获取弹幕
danmu_v2:
method: get
url: /api/live/danmu_v2
params:
channel_id: ${channel_id}
msg_id: ${msg_id}
user_id: ${user_id}
data: {}
json: {}
#主播开播
pushlive_info:
method: get
url: /api/live/push_live_info
params:
title: ${title}
cover_url: ${cover_url}
notice: ${notice}
tag_id: ${tag_id}
clarity: ${clarity}
device_type: ${device_type}
data: {}
json: {}
isLogin: 1
import path_setting
from in_common.base_request import BaseRequest
class my_conversation_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.MY_CONVERSATION_CONFIG)
def my_conversation(self,current_city_id,start_num,count,):
self.params["current_city_id"] = current_city_id
self.params["start_num"] = start_num
self.params["count"] = count
return self.api_send(self.data["my_conversation"])
if __name__ == '__main__':
print(my_conversation_request().my_conversation("beijing", "0", 10))
\ No newline at end of file
my_conversation:
method: get
url: /api/my_conversation/
params:
current_city_id: ${current_city_id}
start_num: ${start_num}
count: 10
data: {}
json: {}
isLogin: 1 #需要登录的接口
\ No newline at end of file
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"])
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().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
params:
uqid: ${uqid}
trace_id: ${trace_id}
data: {}
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
import path_setting
from in_common.base_request import BaseRequest
class oneimage_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.ONEIMAGE_SHARE_V4_CONFIG)
# 测颜值结果页
def share_v4(self,version,face_id):
self.params["version"] = version
self.params["face_id"] = face_id
return self.api_send(self.data["share_v4"])
# 测颜值结果页,根据五官推荐美购接口
def recomend_services(self,version,business_tags_names):
self.params["version"] = version
self.params["business_tags_names"] = business_tags_names
return self.api_send(self.data["recomend_services"])
if __name__ == '__main__':
print(oneimage_request().share_v4("7.42.2", "27320150"))
business_tags_names = '[[],[],["玻尿酸垫下巴","自体脂肪垫下巴","硅胶垫下巴","膨体垫下巴"],["半永久纹眉","植眉"],["玻尿酸丰唇","胶原蛋白填充丰唇","自体脂肪丰唇"],[],["开内眼角"],["射频提升","热拉提","热拉提plus","热玛吉","超声提升"],["热玛吉"],[],["注射瘦脸","激光溶脂瘦脸","取颊脂垫瘦脸","光纤溶脂瘦脸","下颌角整形"]]'
print(oneimage_request().recomend_services("7.42.2", business_tags_names))
\ No newline at end of file
#测肤结果页
share_v4:
method: post
url: /api/one_image/share/v4
params:
version: ${version}
data:
face_id: ${face_id}
json: {}
#测肤结果根据五官推荐美购
recomend_services:
method: get
url: /api/one_image/recomend/services
params:
version: ${version}
business_tags_names: ${business_tags_names}
json: {}
...@@ -5,12 +5,19 @@ from in_common.base_request import BaseRequest ...@@ -5,12 +5,19 @@ from in_common.base_request import BaseRequest
class service_request(BaseRequest): class service_request(BaseRequest):
def __init__(self): 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): def home_v5(self):
return self.api_send(self.data["home_v5"]) return self.api_send(self.data["home_v5"])
#商祥页-收藏
def service_favor(self):
return self.api_send(self.data["service_favor"])
if __name__ == '__main__': if __name__ == '__main__':
print(service_request().home_v5()) print(service_request().home_v5())
\ No newline at end of file
#打印商祥页-收藏接口返回
print(service_request().service_favor())
\ No newline at end of file
...@@ -6,3 +6,13 @@ home_v5: ...@@ -6,3 +6,13 @@ home_v5:
data: {} data: {}
json: {} json: {}
#商祥页-收藏
service_favor:
method: post
url: /api/service/favor/5857263/
params: {}
data: {}
json: {}
isLogin: 1
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class services_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SERVICES_CONFIG)
#商祥页-分享
def share_data(self, p_id, u_id):
self.params["p_id"] = p_id
self.params["u_id"] = u_id
return self.api_send(self.data["share_data"])
if __name__ == '__main__':
#打印商祥页-分享接口返回
print(services_request().share_data("5857263", "618788"))
\ No newline at end of file
#商祥页-分享
share_data:
method: get
url: /api/services/share_data
params:
p_id: ${p_id}
u_id: ${u_id}
data: {}
json: {}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class shopcart_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SHOPCART_CONFIG)
#购物车列表
def list(self):
return self.api_send(self.data["list"])
if __name__ == '__main__':
#打印购物车列表接口返回
print(shopcart_request().list())
\ No newline at end of file
#购物车列表
list:
method: get
url: /api/shopcart/list/v2
params: {}
data: {}
json: {}
isLogin: 1
\ No newline at end of file
import path_setting
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)
#医院主页问答列表
def answer(self, user):
self.params["user"] = user
return self.api_send(self.data["answer"])
if __name__ == '__main__':
#个人中心
print(user_request().personal_center())
print("fgx")
#打印医生/医院主页问答列表接口返回
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
url: /api/user/answer
params:
user: ${user}
count: 10
page: 1
data: {}
json: {}
...@@ -13,5 +13,5 @@ class web2_request(BaseRequest): ...@@ -13,5 +13,5 @@ class web2_request(BaseRequest):
return self.api_send(self.data["service_list"]) return self.api_send(self.data["service_list"])
if __name__ == '__main__': if __name__ == '__main__':
print(web2_request().service_list("1", "10", "-1")) print(web2_request().service_list("1", "10", "-1"))
\ No newline at end of file \ No newline at end of file
...@@ -6,4 +6,5 @@ service_list: ...@@ -6,4 +6,5 @@ service_list:
pagesize: ${pagesize} pagesize: ${pagesize}
is_online: ${is_online} is_online: ${is_online}
data: {} data: {}
json: {} json: {}
\ No newline at end of file isLogin: 1
\ No newline at end of file
develop_host: develop_host:
backend: http://backend.paas-develop.env backend: http://backend.paas-develop.env
# doctor: http://doctor.paas-develop.env/ doctor: http://doctor.paas-develop.env
...@@ -62,6 +62,22 @@ class BaseRequest: ...@@ -62,6 +62,22 @@ class BaseRequest:
def api_send(self, req: dict): def api_send(self, req: dict):
host = self.api_load(path_setting.HOSTYAML_CONFIG) host = self.api_load(path_setting.HOSTYAML_CONFIG)
url_host = ""
# 获取调用该方法的路径
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文档 raw = yaml.dump(req) # 将一个python对象生成为yaml文档
for key, value in self.params.items(): for key, value in self.params.items():
raw = raw.replace(f"${{{key}}}", repr(value)) raw = raw.replace(f"${{{key}}}", repr(value))
...@@ -73,13 +89,18 @@ class BaseRequest: ...@@ -73,13 +89,18 @@ class BaseRequest:
s = LoginFunction().get_session() s = LoginFunction().get_session()
# 调用具体case的url # 调用具体case的url
print(req['method'])
print(url_host + req['url'])
print(req.get('params'))
print(req.get('data'))
r = s.request( r = s.request(
req['method'], req['method'],
url=host['develop_host']['backend'] + req['url'], url=url_host + req['url'],
params=req.get('params'), params=req.get('params'),
# headers=user_headers, # headers=user_headers,
data=req.get('data'), data=req.get('data'),
json=req.get('json') json=req.get('json'),
# proxies={"http":"172.30.9.226:8888"}
) )
return r.json() return r.json()
......
...@@ -36,7 +36,18 @@ class LoginFunction: ...@@ -36,7 +36,18 @@ class LoginFunction:
return s return s
def get_doctor_session(self): def get_doctor_session(self):
pass url = self.host["develop_host"]["doctor"] + self.params["doctor_login"]["url"]
s = requests.session()
r = s.request(
self.params["doctor_login"]["method"],
url=url,
params=self.params["doctor_login"]["params"],
data=self.params["doctor_login"]["data"],
headers={'Connection': 'close'}
)
return s
......
...@@ -9,11 +9,14 @@ backend_login: ...@@ -9,11 +9,14 @@ backend_login:
vfc_type: vfc_type:
face_token: face_token:
#doctor_login: doctor_login:
# method: post method: post
# url: /api url: /api/web/account/login
# params: params: {}
# a: "a" data:
# data: name: "12345654321"
# b: "b" password: 123456
method: password
csrfmiddlewaretoken: "PKHywf6cMBZUkc5WfklO71bQNoMztAfv"
...@@ -8,10 +8,12 @@ LOGIN_FUNCTION_DATA = os.path.join(BASE_DIR, "backend_auto", "login_session_func ...@@ -8,10 +8,12 @@ LOGIN_FUNCTION_DATA = os.path.join(BASE_DIR, "backend_auto", "login_session_func
APYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "account_request.yaml") APYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "account_request.yaml")
LOGIN_VFC = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data", "login_vfc.yaml") LOGIN_VFC = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data", "login_vfc.yaml")
DIARY_DATA_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "diary_data_request.yaml") DIARY_DATA_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "diary_data_request.yaml")
DIARY_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data", "diary_data.yaml") DIARY_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data", "diary_data.yaml")
#搜索首页-热门搜索 #搜索首页-热门搜索
KEYWORDS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "search_request.yaml") KEYWORDS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "search_request.yaml")
KEYWORDS = os.path.join(BASE_DIR, "backend_auto/test_backend_data/search_data", "keywords.yaml") KEYWORDS = os.path.join(BASE_DIR, "backend_auto/test_backend_data/search_data", "keywords.yaml")
...@@ -20,9 +22,38 @@ SERVICE_DATA=os.path.join(BASE_DIR, "backend_auto/test_doctor_data/web2_data", " ...@@ -20,9 +22,38 @@ SERVICE_DATA=os.path.join(BASE_DIR, "backend_auto/test_doctor_data/web2_data", "
SERVICE_URL=os.path.join(BASE_DIR, "backend_auto/all_doctor_api", "web2_request.yaml") SERVICE_URL=os.path.join(BASE_DIR, "backend_auto/all_doctor_api", "web2_request.yaml")
#搜索首页-热门搜索
KEYWORDS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "search_request.yaml")
KEYWORDS = os.path.join(BASE_DIR, "backend_auto/test_backend_data/search_data", "keywords.yaml")
SERVICE_DATA=os.path.join(BASE_DIR, "backend_auto/test_doctor_data/web2_data", "service_list.yaml")
SERVICE_URL=os.path.join(BASE_DIR, "backend_auto/all_doctor_api", "web2_request.yaml")
# 首页灰度v9,精选tab
FEED_INDEXV9_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "feed_request.yaml") FEED_INDEXV9_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "feed_request.yaml")
FEED_INDEXV9_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/feed_data", "index_v9.yaml") FEED_INDEXV9_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/feed_data", "index_v9.yaml")
# 测颜值结果页
ONEIMAGE_SHARE_V4_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "oneimage_request.yaml")
ONEIMAGE_SHARE_V4_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/oneimage_data", "share_v4.yaml")
# 测颜值根据五官推荐美购
ONEIMAGE_RECOMEND_SERVICES_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/oneimage_data", "recomend_services.yaml")
# 测肤结果页 / AI变脸结果页
GMAI_SKIN_NEWREPORT_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "gmai_request.yaml")
GMAI_SKIN_NEWREPORT_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "skin_newReport.yaml")
# 模拟双眼皮
GMAI_EYELIDS_PLASTIC_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "eyelids_plastic.yaml")
# 模拟发型
GMAI_SIMULATE_ANALYZE_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "simulate_analyze.yaml")
# AI变脸结果
GMAI_PLASTIC_ANALYSIS_V3_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "plastic_analysis_v3.yaml")
LOGIN_PASSWD = os.path.join(BASE_DIR, "backend_auto/test_backend_data/accounts_data", "login_passwd.yaml") LOGIN_PASSWD = os.path.join(BASE_DIR, "backend_auto/test_backend_data/accounts_data", "login_passwd.yaml")
LOGIN_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "accounts_request.yaml") LOGIN_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "accounts_request.yaml")
...@@ -31,11 +62,85 @@ HDYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospital ...@@ -31,11 +62,85 @@ HDYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospital
HOSPITAL_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "detail.yaml") HOSPITAL_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "detail.yaml")
#医院主页医生列表 #医院主页医生列表
HOSPITAL_DOCTOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "doctor.yaml") HOSPITAL_DOCTOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "doctor.yaml")
#医院主页商品列表
HOSPITAL_SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospitals_v2_request.yaml")
HOSPITAL_SERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_v2_data", "services.yaml")
#医院主页日记列表
HOSPITAL_DIARY_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospital_request.yaml")
HOSPITAL_DIARY = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospital_data", "diary.yaml")
#医生/医院主页-医生/医院说列表
DOCTOR_ARTICLE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "doctor_request.yaml")
DOCTOR_ARTICLE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/doctor_data", "article.yaml")
#医生主页详情
DOCTOR_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/doctor_data", "detail.yaml")
#医生主页案例列表
DOCTOR_DIARY = os.path.join(BASE_DIR, "backend_auto/test_backend_data/doctor_data", "diary.yaml")
#医生主页商品列表
DOCTOR_V2_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "doctor_v2_request.yaml")
DOCTOR_V2_SERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/doctor_v2_data", "services.yaml")
#医生/医院主页-问答列表
USER_ANSWER_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "user_request.yaml")
USER_ANSWER = os.path.join(BASE_DIR, "backend_auto/test_backend_data/user_data", "answer.yaml")
#购物车列表
SHOPCART_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "shopcart_request.yaml")
SHOPCART_LIST = os.path.join(BASE_DIR, "backend_auto/test_backend_data/shopcart_data", "list.yaml")
#购物车-猜你喜欢列表
JANUS_MINE_GUESS_YOU_LIKE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "mine_guess_you_like.yaml")
#消息列表
MY_CONVERSATION_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "my_conversation_request.yaml")
MY_CONVERSATION = os.path.join(BASE_DIR, "backend_auto/test_backend_data/my_conversation_data", "my_conversation.yaml")
HOME_V5_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "service_request.yaml") 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") 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")
CONTENTV7 = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "content_v7.yaml")
#医院主页搜索
HOSPITALSEARCH_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
HOSPITALSEARCH = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "hospital_search.yaml")
#直播
LIVEYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "live_request.yaml")
#直播-获取弹幕
DANMU_V2 = os.path.join(BASE_DIR, "backend_auto/test_backend_data/live_data", "danmu_v2.yaml")
#直播-主播开播
PUSH_LIVE_INFO = os.path.join(BASE_DIR, "backend_auto/test_backend_data/live_data", "pushlive_info.yaml")
#消息
MESSAGE_READ_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "conversation_request.yaml")
MESSAGE_READ = os.path.join(BASE_DIR, "backend_auto/test_backend_data/conversation_data", "message_read.yaml")
#咨询顾问
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")
AUTO_MSG = os.path.join(BASE_DIR, "backend_auto/test_backend_data/im_data", "auto_msg.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")
#标记为已读
READALL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/notification_data", "readall.yaml")
#商祥页-详情
JANUS_PRODUCT_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "product_detail.yaml")
#商祥页-sku信息
JANUS_SKU_INFO = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "sku_info.yaml")
#商祥页-收藏
SERVICE_FAVOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/service_data", "service_favor.yaml")
#商祥页-分享
SERVICES_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "services_request.yaml")
SERVICES_SHARE_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/services_data", "share_data.yaml")
#品类聚合页面商品列表
TAG_SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
TAG_SERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "tag_service.yaml")
if __name__ == '__main__': if __name__ == '__main__':
print("==========",HOSTYAML_CONFIG) print("==========",LIVEYAML_CONFIG)
...@@ -32,8 +32,14 @@ ...@@ -32,8 +32,14 @@
- test_backend_data 文件主要放测试用例的case - test_backend_data 文件主要放测试用例的case
- host.yaml 维护测试环境的配置文件 - host.yaml 维护测试环境的配置文件
- path_setting.py 文件主要是配置yaml文件的读取路径 - path_setting.py 文件主要是配置yaml文件的读取路径
- login_session_function.py 文件主要提供获取session的功能,方便需登录的接口获取session 2021-4-19新增
- login_session_function.yaml login_session_function.py文件需要登录的数据 2021-4-19新增
- run.py 统一执行入口 - run.py 统一执行入口
### 关于yaml文明书写的注意事项 2021-4-19新增
- yaml文件对空格换行要求非常严格,所以书写时要特别注意
![](.readme_images/yaml文件错误示范.png)
### 如何写一个用例 ### 如何写一个用例
- 先在all_backend_api下找到对应的模块,比如我写节点account下面的接口,那就找到account_request.py这个文件,写接口请求 - 先在all_backend_api下找到对应的模块,比如我写节点account下面的接口,那就找到account_request.py这个文件,写接口请求
......
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.conversation_request import conversation_request
class TestMessageRead:
data = BaseRequest().api_load(path_setting.MESSAGE_READ)
#conversation_case, conversation_data = get_ids(data, "message_read")
messageread_case, messageread_data = get_ids(data, "message_read")
@pytest.mark.parametrize("param",messageread_data,ids=messageread_case)
def test_message_read(self,param):
r = conversation_request().message_read(param["current_city_id"], param["release"], param["message_ids"])
if r["error"] == 0:
assert r["data"]["success"] == param["assert"]
#if r["error"] == 0:
# success = r.get("data").get("success", "")
import pytest
from all_backend_api.doctor_request import doctor_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestArticle:
data = BaseRequest().api_load(path_setting.DOCTOR_ARTICLE)
article_case, article_data = get_ids(data, "article")
@pytest.mark.parametrize("param", article_data, ids=article_case)
def test_article(self, param):
r = doctor_request().article(param["doctor_id"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.doctor_request import doctor_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDetail:
data = BaseRequest().api_load(path_setting.DOCTOR_DETAIL)
detail_case, detail_data = get_ids(data, "detail")
@pytest.mark.parametrize("param", detail_data, ids=detail_case)
def test_detail(self, param):
r = doctor_request().detail()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.doctor_request import doctor_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDiary:
data = BaseRequest().api_load(path_setting.DOCTOR_DIARY)
diary_case, diary_data = get_ids(data, "diary")
@pytest.mark.parametrize("param", diary_data, ids=diary_case)
def test_diary(self, param):
r = doctor_request().diary(param["doctor_id"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.doctor_v2_request import doctor_v2_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestServices:
data = BaseRequest().api_load(path_setting.DOCTOR_V2_SERVICE)
services_case, services_data = get_ids(data, "services")
@pytest.mark.parametrize("param", services_data, ids=services_case)
def test_services(self, param):
r = doctor_v2_request().services()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 模拟双眼皮效果
class TestEyelidsPlastic:
data = BaseRequest().api_load(path_setting.GMAI_EYELIDS_PLASTIC_DATA)
eyelidsplastic_case, eyelidsplastic_data = get_ids(data, "eyelids_plastic")
@pytest.mark.parametrize("param",eyelidsplastic_data,ids=eyelidsplastic_case)
def test_skinnewReport(self,param):
r = gmai_request().eyelids_plastic(param["version"], param["image_url"],param["style_id"])
assert r["error"] == 0
print("模拟双眼皮效果图片: ",r["data"]["plastic_image_url"])
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# AI测颜值,目前测试环境没有召回日记,先保证请求成功
class TestPlasticnAnalysisV3:
data = BaseRequest().api_load(path_setting.GMAI_PLASTIC_ANALYSIS_V3_DATA)
plasticanalysisv3_case, plasticanalysisv3_data = get_ids(data, "analysis_v3")
@pytest.mark.parametrize("param",plasticanalysisv3_data,ids=plasticanalysisv3_case)
def test_plastic_analysis_v3(self,param):
r = gmai_request().plastic_analysis_v3(param["device_id"], param["image_url"], param["landmark"] ,param["cheek_style_classify_id"])
assert r["error"] == 0
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 模拟发型
class TestSimulateAnalyze:
data = BaseRequest().api_load(path_setting.GMAI_SIMULATE_ANALYZE_DATA)
simulateanalyze_case, simulateanalyze_data = get_ids(data, "simulate_analyze")
@pytest.mark.parametrize("param",simulateanalyze_data,ids=simulateanalyze_case)
def test_plastic_analysis_v3(self,param):
r = gmai_request().simulate_analyze(param["device_id"], param["image_url"], param["style_id"] ,param["type_id"])
assert r["error"] == 0
print("效果图: ", r["data"]["plastic_image_url"])
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 测肤结果页
class TestSkinNewReport:
data = BaseRequest().api_load(path_setting.GMAI_SKIN_NEWREPORT_DATA)
skinnewReport_case, skinnewReport_data = get_ids(data, "skin_newReport")
@pytest.mark.parametrize("param",skinnewReport_data,ids=skinnewReport_case)
def test_skinnewReport(self,param):
r = gmai_request().skin_newReport(param["version"], param["image_url"])
if r["error"] == 0:
data = r.get("data")
# 大家都在买
packages = data.get("packages")
assert len(packages) == 6
# 皮肤检测结果
disadvantage_tabs = data.get("disadvantage_tabs")
result_word = disadvantage_tabs[0].get("result_word")
assert result_word == "色素型黑眼圈"
import pytest
from all_backend_api.hospital_request import hospital_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDiary:
data = BaseRequest().api_load(path_setting.HOSPITAL_DIARY)
diary_case, diary_data = get_ids(data, "diary")
@pytest.mark.parametrize("param", diary_data, ids=diary_case)
def test_diary(self, param):
r = hospital_request().diary(param["hospital"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.hospitals_v2_request import hospitals_v2_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestServices:
data = BaseRequest().api_load(path_setting.HOSPITAL_SERVICE)
services_case, services_data = get_ids(data, "services")
@pytest.mark.parametrize("param", services_data, ids=services_case)
def test_detail(self, param):
r = hospitals_v2_request().services()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
assert r["data"]["services"][0]["service_item_id"] == param["assert_sku"]
assert r["data"]["services"][0]["service_id"] == param["assert_spu"]
assert r["data"]["services"][0]["price_info"]["has_discount"] == param["assert_discount"]
assert r["data"]["services"][0]["sales_info"][0]["type"] == param["assert_sales"]
assert r["data"]["services"][0]["exposure"]["card_type"] == param["assert_card_type"]
assert r["data"]["services"][0]["title"] == param["assert_title"]
assert r["data"]["tag_distribution"][0]["selected"] == param["assert_tagselected"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.im_request import im_request
class TestConversationDetail:
data = BaseRequest().api_load(path_setting.AUTO_MSG)
automsg_case, automsg_data = get_ids(data, "auto_msg")
@pytest.mark.parametrize("param",automsg_data,ids=automsg_case)
def test_conversation_detail(self,param):
r = im_request().auto_msg(param["version"], param["uqid"], param["trace_id"], param["conversation_id"])
if r["error"] == 0:
assert r["data"]["send_result"] == param["assert"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.im_request import im_request
class TestConversationDetail:
data = BaseRequest().api_load(path_setting.CONVERSATION_DETAIL)
conversationdetail_case, conversationdetail_data = get_ids(data, "conversation_detail")
@pytest.mark.parametrize("param",conversationdetail_data,ids=conversationdetail_case)
def test_conversation_detail(self,param):
r = im_request().conversation_detail(param["current_city_id"], param["begin_msg_id"], param["conversation_type"], param["end_msg_id"], param["referrer"])
if r["error"] == 0:
msg_list = r.get("data").get("msg_list",[])
assert len(msg_list) > param["assert"]
import pytest
import path_setting
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
#搜索结果页-综合/百科tab
class TestContentV7:
data = BaseRequest().api_load(path_setting.CONTENTV7)
contentv7_case, contentv7_data = get_ids(data, "content_v7")
@pytest.mark.parametrize("param", contentv7_data, ids=contentv7_case)
def test_content_v7(self, param):
print(param['query'])
r = janus_request().content_v7(param["query"], param["device_id"], param["current_city_id"], param["version"], param["is_first"], param["tab_type"], param["offset"])
if r["error"] == 0:
assert r["data"]["cards"][0]["type"] == param["assert"]
if r["error"] == 1:
assert r["message"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
#医院主页搜索
class TestHospitalSearch:
data = BaseRequest().api_load(path_setting.HOSPITALSEARCH)
hospitalsearch_case, hospitalsearch_data = get_ids(data, "hospital_search")
@pytest.mark.parametrize("param", hospitalsearch_data, ids=hospitalsearch_case)
def test_hospital_search(self, param):
print(param['query'])
r = janus_request().hospital_search(param["query"], param["device_id"], param["hospital_id"], param["current_city_id"], param["version"], param["offset"])
if r["error"] == 0:
assert len(r["data"]["search_skus"]) != param["assert1"]
assert len(r["data"]["search_skus"]) == param["assert2"]
if r["error"] == 1:
assert r["message"] == param["assert"]
import pytest
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestMineGuessYouLike:
data = BaseRequest().api_load(path_setting.JANUS_MINE_GUESS_YOU_LIKE)
mine_guess_you_like_case, mine_guess_you_like_data = get_ids(data, "mine_guess_you_like")
@pytest.mark.parametrize("param", mine_guess_you_like_data, ids=mine_guess_you_like_case)
def test_mine_guess_you_like(self, param):
r = janus_request().mine_guess_you_like()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestProductDetail:
data = BaseRequest().api_load(path_setting.JANUS_PRODUCT_DETAIL)
product_detail_case, product_detail_data = get_ids(data, "product_detail")
@pytest.mark.parametrize("param", product_detail_data, ids=product_detail_case)
def test_product_detail(self, param):
r = janus_request().product_detail(param["service_id"], param["service_item_id"], param["version"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
if r["error"] == 1:
assert r["message"] == param["assert_spu_message"]
# if r["error"] == -1:
# assert r["message"] == param["assert_version_message"]
import pytest
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestSkuInfo:
data = BaseRequest().api_load(path_setting.JANUS_SKU_INFO)
sku_info_case, sku_info_data = get_ids(data, "sku_info")
@pytest.mark.parametrize("param", sku_info_data, ids=sku_info_case)
def test_sku_info(self, param):
r = janus_request().sku_info(param["service_id"], param["service_item_id"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.janus_request import janus_request
class TestTagService:
data = BaseRequest().api_load(path_setting.TAG_SERVICE)
tagservice_case, tagservice_data = get_ids(data, "tag_service")
@pytest.mark.parametrize("param", tagservice_data, ids=tagservice_case)
def test_tag_service(self, param):
r = janus_request().tag_service(param["size"], param["tag_ids"], param["offset"], param["tag_id"], param["version"], param["device_id"])
#print('feng=', r)
if r["error"] == 0:
assert r["error"] == param["assert"]
assert r["data"]["offset"] == param["offset"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.live_request import living_request
class TestDanmuV2:
data = BaseRequest().api_load(path_setting.DANMU_V2)
danmuv2_case, danmuv2_data = get_ids(data, "danmu_v2")
@pytest.mark.parametrize("param",danmuv2_data,ids=danmuv2_case)
def test_danmu_v2(self,param):
print(param)
r = living_request().danmu_v2(param["channel_id"],param["msg_id"],param["user_id"])
if r["error"] == 0:
assert r["error"] == param["assert"]
else:
assert r["message"] == param["assert_message"]
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.live_request import living_request
class TestPushLiveInfo:
data = BaseRequest().api_load(path_setting.PUSH_LIVE_INFO)
pushliveinfo_case, pushliveinfo_data = get_ids(data,"push_live_info")
@pytest.mark.parametrize("param", pushliveinfo_data, ids=pushliveinfo_case)
def test_pushlive_info(self, param):
r = living_request().pushlive_info(param["title"],param["cover_url"],param["notice"],param["tag_id"],param["clarity"],param["device_type"])
print('--------',r)
if r["error"] == 0:
assert r["error"] == param["assert"]
else:
assert r["message"] == param['assert_message0']
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.my_conversation_request import my_conversation_request
class TestMyConversation:
data = BaseRequest().api_load(path_setting.MY_CONVERSATION)
my_conversation_case, my_conversation_data = get_ids(data, "my_conversation")
@pytest.mark.parametrize("param",my_conversation_data,ids=my_conversation_case)
def test_my_conversation(self,param):
'''私信列表'''
r = my_conversation_request().my_conversation(param["current_city_id"], param["start_num"], param["count"])
if r["error"] == 0:
conversation_list = r.get("data").get("conversation_list", [])
assert len(conversation_list) <= param["assert"]
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
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
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.oneimage_request import oneimage_request
# 测颜值根据五官推荐美购
class TestRecomendServices:
data = BaseRequest().api_load(path_setting.ONEIMAGE_RECOMEND_SERVICES_DATA)
recomendservice_case, recomendservice_data = get_ids(data, "recomend_services")
# @pytest.mark.skip("跳过测颜值根据五官推荐美购,目前数据是参数是线上的-------------------")
@pytest.mark.parametrize("param",recomendservice_data,ids=recomendservice_case)
def test_recomend_services(self,param):
r = oneimage_request().recomend_services(param["version"], param["business_tags_names"])
if r["error"] == 0:
data = r.get("data")
assert len(data) == param["assert"]
gm_url = data[0].get("gm_url")
assert gm_url.startswith("gengmei://search_result?searchTabType=0") == True, f'返回并非搜索协议,实际是{gm_url}'
assert len(data[0].get("service")) > 0, f'根据五官返回美购个数有误,实际是{len(data[0].get("service"))}'
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.oneimage_request import oneimage_request
class TestShareV4:
"""
测颜值结果页,分享结果
"""
data = BaseRequest().api_load(path_setting.ONEIMAGE_SHARE_V4_DATA)
sharev4_case, sharev4_data = get_ids(data, "share_v4")
# @pytest.mark.skip("跳过,测颜值结果v4,目前数据是线上的-------------------")
@pytest.mark.parametrize("param",sharev4_data,ids=sharev4_case)
def test_share_v4(self,param):
r = oneimage_request().share_v4(param["version"], param["face_id"])
assert r["error"] == 0
...@@ -9,13 +9,13 @@ from all_backend_api.service_request import service_request ...@@ -9,13 +9,13 @@ from all_backend_api.service_request import service_request
class TestHomeV5: class TestHomeV5:
data = BaseRequest().api_load(path_setting.HOME_V5) data = BaseRequest().api_load(path_setting.HOME_V5)
homev5_case, homev5_data = get_ids(data, "home_v5") homev5_case, homev5_data = get_ids(data, "home_v5")
print(data)
@pytest.mark.parametrize("param",homev5_data,ids=homev5_case) @pytest.mark.parametrize("param",homev5_data,ids=homev5_case)
def test_home_v5(self,param): def test_home_v5(self,param):
#print(param["home_v5"])
r = service_request().home_v5() r = service_request().home_v5()
print(r) print(r)
print("home_v6")
#if r["error"] == 0: #if r["error"] == 0:
assert r["error"] == param["assert"] assert r["error"] == param["assert"]
......
import pytest
from all_backend_api.service_request import service_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestServiceFavor:
data = BaseRequest().api_load(path_setting.SERVICE_FAVOR)
service_favor_case, service_favor_data = get_ids(data, "service_favor")
@pytest.mark.parametrize("param", service_favor_data, ids=service_favor_case)
def test_service_favor(self, param):
r = service_request().service_favor()
if r["error"] == 0:
assert r["message"] == param["assert_message"]
print(service_request().service_favor())
import pytest
from all_backend_api.services_request import services_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestShareData:
data = BaseRequest().api_load(path_setting.SERVICES_SHARE_DATA)
share_data_case, share_data_data = get_ids(data, "share_data")
@pytest.mark.parametrize("param", share_data_data, ids=share_data_case)
def test_share_data(self, param):
r = services_request().share_data(param["p_id"], param["u_id"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
# print(services_request().share_data())
import pytest
from all_backend_api.shopcart_request import shopcart_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestList:
data = BaseRequest().api_load(path_setting.SHOPCART_LIST)
list_case, list_data = get_ids(data, "list")
@pytest.mark.parametrize("param", list_data, ids=list_case)
def test_list(self, param):
r = shopcart_request().list()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
import pytest
from all_backend_api.user_request import user_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestAnswer:
data = BaseRequest().api_load(path_setting.USER_ANSWER)
answer_case, answer_data = get_ids(data, "answer")
@pytest.mark.parametrize("param", answer_data, ids=answer_case)
def test_answer(self, param):
r = user_request().answer(param["user"])
if r["error"] == 0:
assert r["error"] == param["assert_error"]
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"]
message_read:
#验证成功case
-
case: "请求成功case"
current_city_id: "beijing"
release: 1
#uqid: "1B519701-A4F5-453E-9D99-140B5AF697A0"
message_ids: [10622,10626,10646,10651]
assert: "true"
\ No newline at end of file
article:
-
case: "校验接口返回成功case"
doctor_id: "9918ad7eb8f511e58f8200163e000a4a"
assert_error: 0
\ No newline at end of file
detail:
-
case: "校验接口返回成功case"
assert_error: 0
\ No newline at end of file
diary:
-
case: "校验接口返回成功case"
doctor_id: 5bd9f05cad51403d853ba8c881989e23
assert_error: 0
\ No newline at end of file
services:
-
case: "校验接口返回成功case"
assert_error: 0
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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