Commit 305c886b authored by aha's avatar aha

更美榜单-机构榜、医生榜

parent 3ef455ce
import path_setting
from in_common.base_request import BaseRequest
class rank_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.RANK_REQUEST_CONFIG)
#更美榜单-机构榜
def rank_hospital(self, city_id, version, device_id= '8C3EB981-B22D-43E2-B208-34F6036505BB'):
self.params["city_id"] = city_id
self.params["version"] = version
return self.api_send(self.data["rank_hospital"])
#更美榜单-医生榜
def rank_doctor(self, city_id, version):
self.params["city_id"] = city_id
self.params["version"] = version
return self.api_send(self.data["rank_doctor"])
if __name__ == '__main__':
print(rank_request().rank_hospital("beijing", "748.0"))
#更美榜单-机构榜
rank_hospital:
method: GET
url: /api/rank/hospital
params:
city_id: ${city_id}
version: ${version}
data: {}
json: {}
#更美榜单-医生榜
rank_doctor:
method: GET
url: /api/rank/doctor
params:
city_id: ${city_id}
version: ${version}
\ No newline at end of file
......@@ -777,6 +777,15 @@ PROJECT_RANK = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data
#项目榜单-商品榜单排序
COMMODITY_RANK = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "commodity_rank.yaml")
#更美榜单
RANK_REQUEST_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "rank_request.yaml")
#更美榜单-机构榜
RANK_HOSPITAL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/rank_data", "rank_hospital.yaml")
#更麽榜单-医生榜
RANK_DOCTOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/rank_data", "rank_doctor.yaml")
......
import pytest
import path_setting
from all_backend_api.rank_request import rank_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestRankDoctor:
data = BaseRequest().api_load(path_setting.RANK_DOCTOR)
rank_doctor_case, rank_doctor_data = get_ids(data, "rank_doctor")
@pytest.mark.parametrize("param", rank_doctor_data, ids=rank_doctor_case)
def test_rank_doctor(self, param):
r = rank_request().rank_doctor(param["city_id"], param["version"])
if r["error"] == 0:
assert r["data"]["data"][0]["hospital"].find(param['assert_city']) != param["assert"]
print("更美榜单-医生榜接口已通")
else:
assert r["data"]["data"][0]["hospital"].find(param["assert_city"]) == param["assert_error"]
print("更美榜单-医生榜,接口出错了")
import pytest
import path_setting
from all_backend_api.rank_request import rank_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestRankHospital:
data = BaseRequest().api_load(path_setting.RANK_HOSPITAL)
rank_hospital_case, rank_hospital_data = get_ids(data, "rank_hospital")
@pytest.mark.parametrize("param", rank_hospital_data, ids=rank_hospital_case)
def test_rank_hospital(self,param):
r = rank_request().rank_hospital(param["city_id"], param["version"])
if r["error"] == 0:
assert r["data"]["data"][0]["name"].find(param["assert_city"]) != param["assert"]
else:
assert r["data"]["data"][0]["name"].find(param["assert_city"]) == param["assert_error"]
rank_doctor:
#更美榜单-医生榜(北京)
-
case: "更美榜单-医生榜(北京)"
city_id: beijing
version: 748.0
assert_city: 北京
assert: -1
assert_error: 99
#更美榜单-医生榜(上海)
-
case: "更美榜单-医生榜(上海)"
city_id: shanghai
version: 748.0
assert_city: 上海
assert: -1
assert_error: 99
\ No newline at end of file
rank_hospital:
#更美榜单-机构榜(北京)
-
case: "更美榜单-机构榜(北京)"
city_id: beijing
version: 748.0
assert_city: 北京
assert: -1
assert_error: 99
#更美榜单-机构榜(上海)
-
case: "更美榜单-机构榜(上海)"
city_id: shanghai
version: 748.0
assert_city: 上海
assert: -1
assert_error: 99
\ 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