Commit c8a9e42f authored by 陈雪's avatar 陈雪

医生后台

parent 29eeba0a
......@@ -7,10 +7,11 @@ class web2_request(BaseRequest):
self.SERVICE_URL = self.api_load(path_setting.SERVICE_URL)
# self.SERVICE_REVIEW_URL = self.api_load(path_setting.SERVICE_REVIEW_URL)
def service_list(self, page,pagesize,is_online):
def service_list(self, page,pagesize,is_online,extra_filter_choice):
self.params["page"] = page
self.params["pagesize"] = pagesize
self.params["is_online"] = is_online
self.params["extra_filter_choice"] = extra_filter_choice
return self.api_send(self.SERVICE_URL["service_list"])
def service_review_list(self,page,pagesize,type):
......@@ -19,8 +20,14 @@ class web2_request(BaseRequest):
self.params["type"] = type
return self.api_send(self.SERVICE_URL["service_review_list"])
def servicereview_option(self,id, type,csrfmiddlewaretoken):
self.params["id"] = id
self.params["type"] = type
self.params["csrfmiddlewaretoken"] = csrfmiddlewaretoken
return self.api_send(self.SERVICE_URL["servicereview_option"])
if __name__ == '__main__':
print(web2_request().service_list("1", "10", "-1"))
# print(web2_request().service_review_list("1", "10", "0"))
\ No newline at end of file
print(web2_request().service_list("1", "10", "-1", "-1"))
print(web2_request().service_review_list("1", "10", "0"))
print(web2_request().servicereview_option("209989", "1", ""))
\ No newline at end of file
......@@ -5,6 +5,7 @@ service_list:
page: ${page}
pagesize: ${pagesize}
is_online: ${is_online}
extra_filter_choice: ${extra_filter_choice}
data:
phone_num: ${phone_num}
vfc_code: ${vfc_code}
......@@ -26,3 +27,18 @@ service_review_list:
face_token: ${face_token}
json: {}
isLogin: 1
servicereview_option:
method: POST
url: /api/web2/servicereview/option
params: {}
data:
id: ${id}
type: ${type}
csrfmiddlewaretoken: ${csrfmiddlewaretoken}
phone_num: ${phone_num}
vfc_code: ${vfc_code}
face_token: ${face_token}
json: {}
isLogin: 1
\ No newline at end of file
......@@ -2,7 +2,11 @@
此文件是用来将case转换成list
'''
def get_ids(data, path):
def get_ids(data: object, path: object) -> object:
"""
@rtype:
"""
params = data[path]
case = []
for ids in params:
......
......@@ -25,7 +25,7 @@ class BaseRequest:
return yaml.safe_load(f)
# 调用yaml加载文件API加载
def api_load(self, path):
def api_load(self, path: object) -> object:
return self.yaml_load(path)
def jsonpath(self, path, r=None, **kwargs):
......@@ -33,7 +33,7 @@ class BaseRequest:
r = self.r.json()
return jsonpath(r, path)
def api_send(self, req: dict):
def api_send(self, req: object) -> object:
host = self.api_load(path_setting.HOSTYAML_CONFIG)
# 获取调用该方法的路径
......
......@@ -25,6 +25,10 @@ SERVICE_URL=os.path.join(BASE_DIR, "backend_auto/all_doctor_api", "web2_request.
#医生后台-商品审核
SERVICE_REVIEW_DATA=os.path.join(BASE_DIR, "backend_auto/test_doctor_data/web2_data", "service_review_list.yaml")
#医生后台-新商品审核-撤回审核
SERVICEREVIEW_OPTION_DATA=os.path.join(BASE_DIR, "backend_auto/test_doctor_data/web2_data", "servicereview_option.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")
......
......@@ -13,7 +13,7 @@ class TestServiceList:
@pytest.mark.parametrize("params",ServiceList_data,ids=ServiceList_case)
def test_ServiceList(self,params):
r = web2_request().service_list(params['page'],params['pagesize'],params['is_online'])
r = web2_request().service_list(params['page'],params['pagesize'],params['is_online'],params['extra_filter_choice'])
print("======",r)
if r["error"] == 0:
assert r["data"]["page"] == params["assert"]
......
......@@ -13,9 +13,11 @@ class TestServiceReviewList:
@pytest.mark.parametrize("params", ServiceReviewList_data, ids=ServiceReviewList_case)
def test_ServiceReviewList(self, params):
r = web2_request().service_review_list(params['page'], params['pagesize'], params['type'])
print("---------",r)
if r["error"] == 0:
assert r["data"]["page"] == params["assert"]
elif r["error"] == 1:
assert r["message"] == params["assert"]
\ No newline at end of file
# elif r["error"] == 1:
# assert r["message"] == params["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_doctor_api.web2_request import web2_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestServicereviewOption:
servicereview_option = BaseRequest().api_load(path_setting.SERVICEREVIEW_OPTION_DATA)
ServicereviewOption_case, ServicereviewOption_data = get_ids(servicereview_option, "servicereview_option")
@pytest.mark.parametrize("params", ServicereviewOption_data, ids=ServicereviewOption_case)
def test_ServicereviewOption(self, params):
r = web2_request().servicereview_option(params['id'], params['type'], params['csrfmiddlewaretoken'])
print("---------",r)
if r["error"] == 0:
assert r["error"] == params["assert"]
# elif r["error"] == 1:
# assert r["data"] == params["assert"]
\ No newline at end of file
service_list:
#有数据返回
#我的商品菜单下有数据返回
-
case: "我的商品-有数据返回"
case: "我的商品-全部tab"
page: "1"
pagesize: "10"
is_online: "-1"
extra_filter_choice: "-1"
assert: 1
-
case: "我的商品-上线tab"
page: "1"
pagesize: "10"
is_online: "-1"
extra_filter_choice: "-1"
assert: 1
-
case: "我的商品-下线tab"
page: "1"
pagesize: "10"
is_online: "0"
extra_filter_choice: "-1"
assert: 1
service_review_list:
#有数据返回
-
case: "商品审核-有数据返回"
case: "我的商品-待升级(全部tab)"
page: "1"
pagesize: "10"
type: "0"
is_online: "-1"
extra_filter_choice: "0"
assert: 1
-
case: "我的商品-待修改类目(全部tab)有数据返回"
page: "1"
pagesize: "10"
is_online: "-1"
extra_filter_choice: "1"
assert: 1
service_review_list:
#有数据返回
-
case: "商品审核-有数据返回"
case: "商品审核-新商品审核"
page: "1"
pagesize: "10"
type: "0"
assert: 1
-
case: "商品审核-商品修改审核"
page: "1"
pagesize: "10"
type: "1"
assert: 1
-
case: "商品审核-新商品审核"
page: "1"
pagesize: "10"
type: "2"
assert: 1
servicereview_option:
#有数据返回
-
case: "商品审核-撤回审核"
id: "209989"
type: "1"
csrfmiddlewaretoken: "PC8uTySuxipukIMuqNV1OPB376C2ZZ3g"
assert: 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