Commit 423e75d3 authored by 张伟男's avatar 张伟男

AI

parents 112c2222 5c181acf
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: {}
......@@ -64,9 +64,9 @@ class BaseRequest:
host = self.api_load(path_setting.HOSTYAML_CONFIG)
url_host = ""
if host["develop_host"].get("doctor") == "http://doctor.paas-develop.env":
if host["develop_host"].get("doctor") is not None:
url_host = host['develop_host']['doctor']
elif host["develop_host"].get("backend") == "http://backend.paas-develop.env":
elif host["develop_host"].get("backend") is not None:
url_host = host['develop_host']['backend']
raw = yaml.dump(req) # 将一个python对象生成为yaml文档
......@@ -86,7 +86,7 @@ class BaseRequest:
params=req.get('params'),
# headers=user_headers,
data=req.get('data'),
json=req.get('json')
json=req.get('json'),verify=False
)
return r.json()
......
......@@ -12,6 +12,16 @@ DIARY_DATA_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "diar
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 = 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")
#搜索首页-热门搜索
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")
......@@ -20,9 +30,24 @@ 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")
#搜索首页-热门搜索
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_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")
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")
......
......@@ -10,7 +10,10 @@ class TestRecomendServices:
data = BaseRequest().api_load(path_setting.ONEIMAGE_RECOMEND_SERVICES_DATA)
recomendservice_case, recomendservice_data = get_ids(data, "recomend_services")
<<<<<<< HEAD
@pytest.mark.skip("跳过测颜值根据五官推荐美购,目前数据是参数是线上的-------------------")
=======
>>>>>>> zwn_test
@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"])
......
......@@ -7,6 +7,7 @@ from all_backend_api.oneimage_request import oneimage_request
class TestShareV4:
<<<<<<< HEAD
"""
测颜值结果页,分享结果
"""
......@@ -14,6 +15,11 @@ class TestShareV4:
sharev4_case, sharev4_data = get_ids(data, "share_v4")
@pytest.mark.skip("跳过,测颜值结果v4,目前数据是线上的-------------------")
=======
data = BaseRequest().api_load(path_setting.ONEIMAGE_SHARE_V4_DATA)
sharev4_case, sharev4_data = get_ids(data, "share_v4")
>>>>>>> zwn_test
@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"])
......
recomend_services:
#成功登录case
-
case: "请求成功,有数据返回"
version: "7.42.2"
business_tags_names: '[[],[],["玻尿酸垫下巴","自体脂肪垫下巴","硅胶垫下巴","膨体垫下巴"],["半永久纹眉","植眉"],["玻尿酸丰唇","胶原蛋白填充丰唇","自体脂肪丰唇"],[],["开内眼角"],["射频提升","热拉提","热拉提plus","热玛吉","超声提升"],["热玛吉"],[],["注射瘦脸","激光溶脂瘦脸","取颊脂垫瘦脸","光纤溶脂瘦脸","下颌角整形"]]'
assert: 0
\ No newline at end of file
share_v4:
#成功登录case
-
case: "请求成功,有数据返回"
version: "7.42.2"
face_id: "27320150"
assert: 0
\ No newline at end of file
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