Commit 6a3c57f3 authored by 张伟男's avatar 张伟男

测肤获取方案,美券美购列表

parent 2e68d056
......@@ -13,7 +13,13 @@ class services_request(BaseRequest):
self.params["u_id"] = u_id
return self.api_send(self.data["share_data"])
# 普通美券点击立即使用
def v1(self, coupon_info_id, order_by):
self.params["coupon_info_id"] = coupon_info_id
self.params["order_by"] = order_by
return self.api_send(self.data["share_data"])
if __name__ == '__main__':
#打印商祥页-分享接口返回
print(services_request().share_data("5857263", "618788"))
\ No newline at end of file
# print(services_request().share_data("5857263", "618788"))
print(services_request().v1(32366785, 0))
\ No newline at end of file
......@@ -6,4 +6,13 @@ share_data:
p_id: ${p_id}
u_id: ${u_id}
data: {}
json: {}
\ No newline at end of file
json: {}
#获取美购列表,美券
share_data:
method: get
url: /api/services/v1
params:
coupon_info_id: ${coupon_info_id}
order_by: ${order_by}
\ No newline at end of file
......@@ -15,6 +15,13 @@ class skin_request(BaseRequest):
self.params["device_id"] = device_id
return self.api_send(self.data["skin_recommend_service"])
# 测肤根据需求获取方案
def skin_scheme_card(self, scene_id, target_id, recover_time_id):
self.params["scene_id"] = scene_id
self.params["target_id"] = target_id
self.params["recover_time_id"] = recover_time_id
return self.api_send(self.data["skin_scheme_card"])
if __name__ == '__main__':
print(skin_request().skin_recommend_service("androidid_7255c3398845cdd5", "beijing", '[2306,2303,2551,2355,2322,2337]', 0, 10))
# print(skin_request().skin_recommend_service("androidid_7255c3398845cdd5", "beijing", '[2306,2303,2551,2355,2322,2337]', 0, 10))
print(skin_request().skin_scheme_card(1, 1, 1))
......@@ -6,4 +6,12 @@ skin_recommend_service:
offset: ${offset}
size: ${size}
appeal_tag_ids: ${appeal_tag_ids}
device_id: ${device_id}
\ No newline at end of file
device_id: ${device_id}
skin_scheme_card:
method: get
url: /api/skin/scheme/card
params:
scene_id: ${scene_id}
target_id: ${target_id}
recover_time_id: ${recover_time_id}
\ No newline at end of file
......@@ -230,6 +230,8 @@ SCAN_DIARY_CARDS_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/s
# 测肤质feed流
SKIN_RECOMMEND_SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "skin_request.yaml")
SKIN_RECOMMEND_SERVICE_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/skin_data", "recommend_service.yaml")
# 测肤质根据选择获取推荐方案
SKIN_SCHEME_CARD_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/skin_data", "scheme_card.yaml")
# 测肤结果页 / AI变脸结果页
GMAI_SKIN_NEWREPORT_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "gmai_request.yaml")
......@@ -358,6 +360,9 @@ SERVICE_FAVOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/service_d
#商祥页-分享
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")
# 美券点击立即使用获取美购列表
SERVICES_V1_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/services_data", "v1.yaml")
#商祥页-加入购物车
SHOPCART_ADD = os.path.join(BASE_DIR, "backend_auto/test_backend_data/shopcart_data", "add.yaml")
#商祥页-美券列表
......
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 TestV1:
data = BaseRequest().api_load(path_setting.SERVICES_V1_DATA)
v1_case, v1_data = get_ids(data, "v1")
@pytest.mark.parametrize("param", v1_data, ids=v1_case)
def test_share_data(self, param):
r = services_request().v1(param["coupon_info_id"], param["order_by"])
if r["error"] == 0:
assert len(r["data"]) > 0
print(r)
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.skin_request import skin_request
# 测肤底根据选项获取推荐方案
class TestSkinSchemeCard:
data = BaseRequest().api_load(path_setting.SKIN_SCHEME_CARD_DATA)
skin_scheme_card_case, skin_scheme_card_data = get_ids(data, "scheme_card")
@pytest.mark.parametrize("param", skin_scheme_card_data, ids=skin_scheme_card_case)
def test_scheme_card(self,param):
r = skin_request().skin_scheme_card(param["scene_id"], param["target_id"], param["recover_time_id"])
if r["error"] == 0:
# 推荐美购卡片下面文案部分
title = r["data"]["title"]
content = r["data"]["content"]
assert title == param["title"]
assert content == param["content"]
# 用户选择目标
scene_name = r["data"]["scene_name"]
target_name = r["data"]["target_name"]
recover_time_name = r["data"]["recover_time_name"]
assert scene_name == param["scene_name"]
assert target_name == param["target_name"]
assert recover_time_name == param["recover_time_name"]
# 推荐美购卡片信息
original_price = r["data"]["service_card"]["original_price"]
gengmei_price = r["data"]["service_card"]["gengmei_price"]
assert original_price not in (None, "")
assert gengmei_price not in (None, "")
service_id = r["data"]["service_card"]["service_id"]
service_name = r["data"]["service_card"]["service_name"]
assert service_name not in (None, "")
image_header = r["data"]["service_card"]["image_header"]
assert image_header not in (None, "")
# import requests
# resp = requests.get(url=image_header, verify=False)
# print(resp.text)
# # 判断返回是否有报错信息,否则是一张图片
# assert "errcode" not in resp.text, f'测颜值返回二维码图片不可用'
gm_url = r["data"]["service_card"]["gm_url"]
assert gm_url == "gengmei://service?service_id={}&sign_points=20&has_task=0&transparent_key=rm_r63bkpbh_0&sign_task_seconds=10".format(service_id)
\ No newline at end of file
v1:
-
case: "美券立即使用获取美购列表接口"
coupon_info_id: 32366785
order_by: 0
\ No newline at end of file
scheme_card:
-
case: "测肤质根据用户选择获取方案"
scene_id: 1
target_id: 1
recover_time_id: 1
title: "让你无法拒绝的无针水光"
content: "最近的工作不堪负荷,特别疲累,皮肤有些崩溃了,脸上开始有些干燥起皮,肤色也暗沉了不少。无针水光是我最爱的急救提亮肤色项目,整个项目不到20分钟,效果比补水面膜好太多,通过高气压把玻尿酸精华喷射在皮肤,做完皮肤像喝饱水充满了能量,肤色变亮且通透有光泽。"
scene_name: "约会"
target_name: "美白提亮"
recover_time_name: "立刻马上"
\ 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