Commit 4d71699c authored by aha's avatar aha

小程序-搜索结果页接口

parent 8dd25226
......@@ -10,6 +10,7 @@ class search_request(BaseRequest):
self.data = self.api_load(path_setting.KEYWORDS_CONFIG) #keywords路径
self.data = self.api_load(path_setting.CONTENTV6_CONFIG) #content_v6路径
self.data = self.api_load(path_setting.HOT_CONFIG) # hot路径
self.data = self.api_load(path_setting.V2SERVICE_CONFIG) #小程序-搜索结果页
#搜索首页-热门搜索模块(点击搜索框即调接口)
def keywords(self,current_city_id,search_tab):
......@@ -53,10 +54,23 @@ class search_request(BaseRequest):
return self.api_send(self.data["hospital"])
#小程序-搜索结果页
def v2_service(self, q, input_type, version, page, start_num):
self.params["q"] = q
self.params["input_type"] = input_type
self.params["version"] = version
self.params["page"] = page
self.params["start_num"] = start_num
return self.api_send(self.data["v2_service"])
if __name__ == '__main__':
# 打印购物车-猜你喜欢列表接口返回
print(search_request().hospital(82, [], "眼部整形", 10, "869378034450718"))
#print(search_request().hospital(82, [], "眼部整形", 10, "869378034450718"))
# 小程序-搜索结果页
print(search_request().v2_service("玻尿酸","4", "7.36.0", "1", "0"))
......@@ -50,3 +50,15 @@ hospital:
data: {}
json: {}
#小程序-搜索结果页
v2_service:
method: get
url: /api/search/v2/service
params:
q: ${q}
input_type: ${input_type}
version: ${version}
page: ${page}
start_num: ${start_num}
data: {}
json: {}
\ No newline at end of file
......@@ -456,6 +456,9 @@ BEAUTY_CARD_ORDER_DETAIL_DATA = os.path.join(BASE_DIR, "backend_auto/test_backen
CONTENTV6_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "search_request.yaml")
CONTENTV6 = os.path.join(BASE_DIR, "backend_auto/test_backend_data/search_data", "content_v6.yaml")
#小程序-搜索结果页
V2SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "search_request.yaml")
V2SERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/search_data", "v2_service.yaml")
#品类聚合页面商品列表
TAG_SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
......
import pytest
import path_setting
from all_backend_api.search_request import search_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestV2Service:
data = BaseRequest().api_load(path_setting.V2SERVICE)
v2service_case, v2service_data = get_ids(data, "v2_service")
@pytest.mark.parametrize("param", v2service_data, ids=v2service_case)
def test_v2_service(self,param):
r = search_request().v2_service(param['q'], param['input_type'], param['version'], param['page'], param['start_num'])
if r["error"] == 0:
assert len(r["data"]["services"]) == param["assert"]
else:
assert r["error"] == param["assert_error"]
v2_service:
#小程序-搜索结果页
-
case: "小程序端-搜索玻尿酸,正常召回搜索结果"
q: 玻尿酸
input_type: 4
version: 7.36.0
page: 1
start_num: 0
assert: 10
assert_error: "接口报错啦"
-
case: "小程序端-搜索呵呵,无结果召回"
q: 呵呵
input_type: 4
version: 7.36.0
page: 1
start_num: 0
assert: 0
assert_error: "接口报错啦"
\ 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