Commit b70d82a4 authored by 张慧's avatar 张慧

自定义专题接口

parent 46430401
......@@ -6,7 +6,12 @@ class visual_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.VISUAL_CONFIG)
# 签到--其他tab 美购feed——自定义专题
# 自定义专题详情
def page_detail(self, page_id):
self.params["page_id"] = page_id
return self.api_send(self.data["page_detail"])
# 签到--其他tab 美购feed——自定义专题商品列表
def service_list(self, unit_id, page, current_city_id, order_by, area, tag_ids):
self.params["unit_id"] = unit_id
self.params["page"] = page
......@@ -14,7 +19,17 @@ class visual_request(BaseRequest):
self.params["order_by"] = order_by
self.params["area"] = area
self.params["tag_ids"] = tag_ids
return self.api_send(self.data['service_list'])
return self.api_send(self.data["service_list"])
# 自定义专题-筛选器
def unit_filter(self, unit_id):
self.params["unit_id"] = unit_id
return self.api_send(self.data["unit_filter"])
if __name__ == '__main__':
print(visual_request().service_list(20236, 0, "beijing", 0, "worldwide", [66]))
\ No newline at end of file
# 自定义专题详情
# print(visual_request().page_detail(903))
# 自定义专题商品列表
# print(visual_request().service_list(20236, 0, "beijing", 0, "worldwide", [66]))
# 自定义专题筛选器
print(visual_request().unit_filter(20236))
#签到--其他tab 美购feed——自定义专题
#自定义专题详情
page_detail:
method: get
url: /api/visual/page/detail
params:
page_id: ${page_id}
data: {}
json: {}
#签到--其他tab 美购feed——自定义专题商品列表
service_list:
method: GET
url: /api/visual/service_list
......@@ -11,4 +20,12 @@ service_list:
tag_ids: ${tag_ids}
data: {}
json: {}
is_Login: 1
\ No newline at end of file
#自定义专题筛选器
unit_filter:
method: get
url: /api/visual/unit_filter
params:
unit_id: ${unit_id}
data: {}
json: {}
\ No newline at end of file
......@@ -159,6 +159,8 @@ SIGN_CALENDAR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/user_data
# 签到--其他 tab feed --自定义专题商品列表
VISUAL_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "visual_request.yaml")
VISUAL_SERVICE_LIST = os.path.join(BASE_DIR, "backend_auto/test_backend_data/visual_data", "service_list.yaml")
VISUAL_UNIT_FILTER = os.path.join(BASE_DIR, "backend_auto/test_backend_data/visual_data", "unit_filter.yaml")
VISUAL_PAGE_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/visual_data", "page_detail.yaml")
#搜索首页-热门搜索
......
import pytest
import path_setting
from all_backend_api.visual_request import visual_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestPageDetail:
data = BaseRequest().api_load(path_setting.VISUAL_PAGE_DETAIL)
page_detail_case, page_detail_data = get_ids(data, "page_detail")
@pytest.mark.parametrize("param", page_detail_data, ids=page_detail_case)
def test_page_detail(self, param):
r = visual_request().page_detail(param["page_id"])
assert r["error"] == param["assert"]
assert len(r["data"]["unit_list"]) > 0
assert r["data"]["area"] is not None
assert r["data"]["id"] is not None
assert r["data"]["share_data"] is not None
assert r["data"]["name"] is not None
import pytest
import path_setting
from all_backend_api.visual_request import visual_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestUnitFilter:
data = BaseRequest().api_load(path_setting.VISUAL_UNIT_FILTER)
unit_filter_case, unit_filter_data = get_ids(data, "unit_filter")
@pytest.mark.parametrize("param", unit_filter_data, ids=unit_filter_case)
def test_unit_filter(self, param):
r = visual_request().unit_filter(param["unit_id"])
assert r["error"] == param["assert"]
assert r["data"]["field"] is not None
assert r["data"]["order"] is not None
assert r["data"]["areas"] is not None
page_detail:
-
case: "自定义专题详情接口调用成功case"
page_id: 903
assert: 0
-
case: "自定义专题详情接口返回数据正常case"
page_id: 903
assert: 0
\ No newline at end of file
unit_filter:
-
case: "自定义专题筛选器接口成功case"
unit_id: 20236
assert: 0
-
case: "自定义专题筛选器接口数据返回正常case"
unit_id: 20236
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