Commit ff788e17 authored by aha's avatar aha

搜索结果页综合/百科tab和医院主页搜索

parent cfca6890
import path_setting
from in_common.base_request import BaseRequest
class janus_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.CONTENTV7_CONFIG)
self.data = self.api_load(path_setting.HOSPITALSEARCH_CONFIG)
#搜索结果页-综合/百科tab
def content_v7(self, query, device_id, current_city_id, version, is_first, tab_type, offset):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#是否为第一次请求
self.params['is_first'] = is_first
#类型
self.params['tab_type'] = tab_type
#请求的页数 0,10,20
self.params['offset'] = offset
return self.api_send(self.data['content_v7'])
#医院主页搜索
def hospital_search(self, query, device_id, hospital_id, current_city_id, version, offset):
#搜索词
self.params['query'] = query
#设备号
self.params['device_id'] = device_id
#医院id
self.params['hospital_id'] = hospital_id
#当前城市
self.params['current_city_id'] = current_city_id
#APP版本
self.params['version'] = version
#请求的页数 0,10,20
self.params['offset'] = offset
return self.api_send(self.data['hospital_search'])
content_v7:
method : get
url : /api/janus/search/v7/content
params :
query: ${query}
device_id: ${device_id}
current_city_id: ${current_city_id}
version: ${version}
is_first: ${is_first}
tab_type: ${tab_type}
offset: ${offset}
data: {}
json: {}
hospital_search:
method: get
url: /api/janus/search/hospital_search
params:
query: ${query}
device_id: ${device_id}
hospital_id: ${hospital_id}
current_city_id: ${current_city_id}
version: ${version}
offset: ${offset}
data: { }
json: { }
......@@ -36,6 +36,13 @@ HOSPITAL_DOCTOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospita
HOME_V5_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "service_request.yaml")
HOME_V5=os.path.join(BASE_DIR,"backend_auto/test_backend_data/service_data","home_v5.yaml")
#搜索结果页-综合/百科
CONTENTV7_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
CONTENTV7 = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "content_v7.yaml")
#医院主页搜索
HOSPITALSEARCH_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
HOSPITALSEARCH = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "hospital_search.yaml")
if __name__ == '__main__':
print("==========",HOSTYAML_CONFIG)
import pytest
import path_setting
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
#搜索结果页-综合/百科tab
class TestContentV7:
data = BaseRequest().api_load(path_setting.CONTENTV7)
contentv7_case, contentv7_data = get_ids(data, "content_v7")
@pytest.mark.parametrize("param", contentv7_data, ids=contentv7_case)
def test_content_v7(self, param):
print(param['query'])
r = janus_request().content_v7(param["query"], param["device_id"], param["current_city_id"], param["version"], param["is_first"], param["tab_type"], param["offset"])
if r["error"] == 0:
assert r["data"]["cards"][0]["type"] == param["assert"]
if r["error"] == 1:
assert r["message"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_request import janus_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
#医院主页搜索
class TestHospitalSearch:
data = BaseRequest().api_load(path_setting.HOSPITALSEARCH)
hospitalsearch_case, hospitalsearch_data = get_ids(data, "hospital_search")
@pytest.mark.parametrize("param", hospitalsearch_data, ids=hospitalsearch_case)
def test_hospital_search(self, param):
print(param['query'])
r = janus_request().hospital_search(param["query"], param["device_id"], param["hospital_id"], param["current_city_id"], param["version"], param["offset"])
if r["error"] == 0:
assert len(r["data"]["search_skus"]) != param["assert1"]
assert len(r["data"]["search_skus"]) == param["assert2"]
if r["error"] == 1:
assert r["message"] == param["assert"]
content_v7:
-
#搜索结果页-综合tab---搜索成功
case: "搜索结果页--综合tab---搜索成功"
query: "脱毛"
device_id: "1321222222222222135"
current_city_id: "beijing"
version: "742.2"
is_first: "1"
tab_type: "0"
offset: "0"
assert: 2
-
#搜索结果页-百科tab---搜索成功
case: "搜索结果页-百科tab---搜索成功"
query: "双眼皮"
device_id: "1321222222222222135"
current_city_id: "beijing"
version: "742.2"
is_first: "0"
tab_type: "12"
offset: "0"
assert: 12
-
#搜索结果页-综合tab---下拉加载成功(请求第二波数据)
case: "搜索结果页--综合tab---下拉加载成功(请求第二波数据)"
query: "双眼皮"
device_id: "1321222222222222135"
current_city_id: "beijing"
version: "742.2"
is_first: "0"
tab_type: "0"
offset: "10"
assert: 2
-
#搜索结果页-百科tab---下拉加载成功(请求第二波数据)
case: "搜索结果页-百科tab---下拉加载成功(请求第二波数据)"
query: "双眼皮"
device_id: "1321222222222222135"
current_city_id: "beijing"
version: "742.2"
is_first: "0"
tab_type: "12"
offset: "10"
assert: 12
# -测试环境无法验证该用例
# #搜索结果页-综合tab---召回百科穿插
# case: "搜索结果页--综合tab---没有召回百科穿插"
# query: "双眼皮"
# device_id: "1321222222222222135"
# current_city_id: "beijing"
# version: "742.2"
# is_first: "1"
# tab_type: "0"
# offset: "0"
# assert: 12
-
#搜索结果页-综合tab---搜索词为医院全称或简称,搜索结果页医院穿插置顶展示
case: "搜索结果页-综合tab---搜索词为医院全称或简称,搜索结果页医院穿插置顶展示"
query: "北京凯润婷"
device_id: "1321222222222222135"
current_city_id: "beijing"
version: "742.2"
is_first: "1"
tab_type: "0"
offset: "0"
assert: 3
-
#搜索结果页-综合tab---搜索词为医生全称,搜索结果页医生穿插置顶展示
case: "搜索结果页-综合tab---搜索词为医生全称,搜索结果页医生穿插置顶展示"
query: "崔鑫"
device_id: "1321222222222222135"
current_city_id: "beijing"
version: "742.2"
is_first: "1"
tab_type: "0"
offset: "0"
assert: 6
\ No newline at end of file
hospital_search:
-
#医院主页搜索---搜索成功,有数据召回
case: "医院主页搜索---搜索成功,有数据召回"
query: "玻尿酸"
device_id: "1321222222222222135"
hospital_id: "96ea37eef81d11e692f800163e000a4a"
current_city_id: "beijing"
version: "742.2"
offset: "0"
assert1: 0
assert2: 10
-
#医院主页搜索---搜索成功,无数据召回
case: "医院主页搜索---搜索成功,无数据召回"
query: "美白针"
device_id: "1321222222222222135"
hospital_id: "96ea37eef81d11e692f800163e000a4a"
current_city_id: "beijing"
version: "742.2"
offset: "0"
assert1: 10
assert2: 0
# -
# #医院主页搜索---搜索成功,无数据召回
# case: "医院主页搜索---搜索成功,无数据召回"
# query: "瘦脸针"
# device_id: "1321222222222222135"
# hospital_id: "96ea37eef81d11e692f800163e000a4a"
# current_city_id: "beijing"
# version: "742.2"
# offset: "0"
# assert1: 0
# assert2: 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