Commit 2cc9caa1 authored by admin's avatar admin

医院主页商品列表接口

parent 7c17ab53
import path_setting
from in_common.base_request import BaseRequest
class hospitals_v2_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.HOSPITAL_SERVICE_CONFIG)
#医院主页商品列表
def services(self):
return self.api_send(self.data["services"])
if __name__ == '__main__':
#打印医院主页商品列表接口返回
print(hospitals_v2_request().services())
\ No newline at end of file
#商品列表
services:
method: get
url: /api/hospitals_v2/bjxyjcpfbyy/services
params:
offset: 0
show_tag_distro: 1
tag_id: "all"
size: 10
data: {}
json: {}
\ No newline at end of file
...@@ -31,7 +31,9 @@ HDYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospital ...@@ -31,7 +31,9 @@ HDYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospital
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") HOSPITAL_DOCTOR = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_data", "doctor.yaml")
#医院主页商品列表
HOSPITAL_SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "hospitals_v2_request.yaml")
HOSPITAL_SERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/hospitals_v2_data", "services.yaml")
HOME_V5_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "service_request.yaml") 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") HOME_V5=os.path.join(BASE_DIR,"backend_auto/test_backend_data/service_data","home_v5.yaml")
......
import pytest
from all_backend_api.hospitals_v2_request import hospitals_v2_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
class TestServices:
data = BaseRequest().api_load(path_setting.HOSPITAL_SERVICE)
services_case, services_data = get_ids(data, "services")
@pytest.mark.parametrize("param", services_data, ids=services_case)
def test_detail(self, param):
r = hospitals_v2_request().services()
if r["error"] == 0:
assert r["error"] == param["assert_error"]
assert r["data"]["services"][0]["service_item_id"] == param["assert_sku"]
assert r["data"]["services"][0]["service_id"] == param["assert_spu"]
assert r["data"]["services"][0]["price_info"]["has_discount"] == param["assert_discount"]
assert r["data"]["services"][0]["sales_info"][0]["type"] == param["assert_sales"]
assert r["data"]["services"][0]["exposure"]["card_type"] == param["assert_card_type"]
assert r["data"]["services"][0]["title"] == param["assert_title"]
assert r["data"]["tag_distribution"][0]["selected"] == param["assert_tagselected"]
services:
-
case: "校验接口调用成功case"
assert_error: 0
assert_sku: 546450
assert_spu: 5866530
assert_discount: True
assert_sales: 3
assert_card_type: "card"
assert_title: "【G点注射】G点注射激活修复,G点玻尿酸注射唤醒 提升G点敏感度 提升塑造敏感G点 G点增厚 小阴唇整形 修复矫正"
assert_tagselected: true
-
case: "校验商品数据case"
assert_error: 0
assert_sku: 546450
assert_spu: 5866530
assert_discount: True
assert_sales: 3
assert_card_type: "card"
assert_title: "【G点注射】G点注射激活修复,G点玻尿酸注射唤醒 提升G点敏感度 提升塑造敏感G点 G点增厚 小阴唇整形 修复矫正"
assert_tagselected: true
-
case: "校验商品标签数据case"
assert_error: 0
assert_sku: 546450
assert_spu: 5866530
assert_discount: True
assert_sales: 3
assert_card_type: "card"
assert_title: "【G点注射】G点注射激活修复,G点玻尿酸注射唤醒 提升G点敏感度 提升塑造敏感G点 G点增厚 小阴唇整形 修复矫正"
assert_tagselected: true
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