Commit 4f13b3a1 authored by aha's avatar aha

Merge branch 'cuixin_dev' into common_dev

搜索首页-热门搜索
parents 968ea294 0d1d4610
import path_setting
from in_common.base_request import BaseRequest
class search_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.KEYWORDS_CONFIG)
#搜索首页-热门搜索模块(点击搜索框即调接口)
def keywords(self,current_city_id,search_tab):
self.params["current_city_id"] = current_city_id
self.params["search_tab"] = search_tab
return self.api_send(self.data["keywords"])
\ No newline at end of file
keywords:
method: get
#接口地址
url: /api/search/keywords
#列出所有定义函数时的参数
params:
current_city_id: ${current_city_id}
search_tab: ${search_tab}
data: {}
json: {}
\ No newline at end of file
......@@ -6,6 +6,8 @@ sys.path.append(BASE_DIR)
HOSTYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto", "host.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")
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")
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")
......
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 TestKeywords:
data = BaseRequest().api_load(path_setting.KEYWORDS)
keywords_case, keywords_data = get_ids(data, "keywords")
@pytest.mark.parametrize("param", keywords_data, ids=keywords_case)
def test_keywords(self, param):
r = search_request().keywords(param["current_city_id"], param["search_tab"])
if r["error"] == 0:
assert r["error"] == param["assert"]
print("接口调用成功了~")
keywords:
-
#进入搜索首页
case : "进入搜索首页-成功调用搜索首页接口"
current_city_id : "beijing"
search_tab : "0"
assert : 0
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