Commit 1c2399d6 authored by admin's avatar admin

医院主页医生列表接口自动化

parent d34c09be
...@@ -7,9 +7,18 @@ class hospitals_request(BaseRequest): ...@@ -7,9 +7,18 @@ class hospitals_request(BaseRequest):
def __init__(self): def __init__(self):
self.data = self.api_load(path_setting.HDYAML_CONFIG) self.data = self.api_load(path_setting.HDYAML_CONFIG)
#医院主页详情
def detail(self): def detail(self):
return self.api_send(self.data["detail"]) return self.api_send(self.data["detail"])
#医院主页医生列表
def doctor(self):
return self.api_send(self.data["doctor"])
if __name__ == '__main__': if __name__ == '__main__':
#打印医院主页详情接口返回
print(hospitals_request().detail()) print(hospitals_request().detail())
#打印医院主页医生列表接口返回
print(hospitals_request().doctor())
\ No newline at end of file
#详情
detail: detail:
method: get method: get
url: /api/hospitals/bjxyjcpfbyy/detail url: /api/hospitals/bjxyjcpfbyy/detail
params: {} params: {}
data: {}
json: {}
#医生列表
doctor:
method: get
url: /api/hospitals/bjxyjcpfbyy/doctors
params:
related: 0
data: {} data: {}
json: {} json: {}
\ No newline at end of file
...@@ -10,6 +10,8 @@ LOGIN_VFC = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data" ...@@ -10,6 +10,8 @@ LOGIN_VFC = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data"
#医院主页详情 #医院主页详情
HDYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospitals_request.yaml") HDYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospitals_request.yaml")
HOSPITAL_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "detail.yaml") HOSPITAL_DETAIL = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "detail.yaml")
#医院主页医生列表
HOSPITAL_DOCTOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "doctor.yaml")
if __name__ == '__main__': if __name__ == '__main__':
print("==========",HOSTYAML_CONFIG) print("==========",HOSTYAML_CONFIG)
import pytest
from all_backend_api.hospitals_request import hospitals_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestDoctor:
data = BaseRequest().api_load(path_setting.HOSPITAL_DOCTOR)
doctor_case, doctor_data = get_ids(data, "doctor")
@pytest.mark.parametrize("param", doctor_data, ids=doctor_case)
def test_doctor(self, param):
r = hospitals_request().doctor()
assert r["error"] == param["assert_error"]
assert r["data"][0]["id"] == param["assert_id"]
assert r["data"][0]["doctor_name"] == param["assert_name"]
assert r["data"][0]["good_at"][0] == param["assert_good_at"]
assert r["data"][0]["cases"][0]["name"] == param["assert_cases"]
assert r["data"][0]["title"] == param["assert_title"]
doctor:
-
case: "校验接口返回成功case"
assert_error: 0
assert_id: "ad99d0b0b6eb4a2c97ffadad48b7cdfd"
assert_name: "赵希军"
assert_good_at: "吸脂瘦身"
assert_cases: "自体脂肪填充面部 80例"
assert_title: "副主任"
-
case: "校验医生id case"
assert_error: 0
assert_id: "ad99d0b0b6eb4a2c97ffadad48b7cdfd"
assert_name: "赵希军"
assert_good_at: "吸脂瘦身"
assert_cases: "自体脂肪填充面部 80例"
assert_title: "副主任"
-
case: "校验医生名称case"
assert_error: 0
assert_id: "ad99d0b0b6eb4a2c97ffadad48b7cdfd"
assert_name: "赵希军"
assert_good_at: "吸脂瘦身"
assert_cases: "自体脂肪填充面部 80例"
assert_title: "副主任"
-
case: "校验医生明星项目case"
assert_error: 0
assert_id: "ad99d0b0b6eb4a2c97ffadad48b7cdfd"
assert_name: "赵希军"
assert_good_at: "吸脂瘦身"
assert_cases: "自体脂肪填充面部 80例"
assert_title: "副主任"
-
case: "校验医生案例case"
assert_error: 0
assert_id: "ad99d0b0b6eb4a2c97ffadad48b7cdfd"
assert_name: "赵希军"
assert_good_at: "吸脂瘦身"
assert_cases: "自体脂肪填充面部 80例"
assert_title: "副主任"
-
case: "校验医生title case"
assert_error: 0
assert_id: "ad99d0b0b6eb4a2c97ffadad48b7cdfd"
assert_name: "赵希军"
assert_good_at: "吸脂瘦身"
assert_cases: "自体脂肪填充面部 80例"
assert_title: "副主任"
\ 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