def test_user(self): current_page = 1 order_length = 0 res = ApiFactory.get_order().user_api(current_page) auto(self, res.json().get("current_page"), current_page) auto(self, len(res.json().get("data")), order_length, "more")
def test_create(self): # 数据-状态码 order_code = 200 # 数据-pass order_pass = True # 数据-长度 order_length = 0 # 请求 res = ApiFactory.get_order().create_api() # 断言 auto(self, res.status_code, order_code) auto(self, len(res.json().get("order_no")), order_length, tag="more") auto(self, len(res.json().get("order_id")), order_length, tag="more") auto(self, res.json().get("pass"), order_pass)
def test_query(self): # 数据-状态码 order_code = 200 # 数据-id order_id = 50 # 数据-no order_no = "CB15039906369944" # 数据-total_price order_total_price = '0.03' res = ApiFactory.get_order().query_api(order_id) auto(self, res.status_code, order_code) auto(self, res.json().get("id"), order_id) auto(self, res.json().get("order_no"), order_no) auto(self, res.json().get("total_price"), order_total_price)
from Api.apiFactory import ApiFactory from Utils import app # 轮播图 # print("轮播图:{}".format(HomeApi().banner().json())) # # # 专题栏 # print("专题栏:{}".format(HomeApi().theme().json())) # # # 最近新品 # print("最近新品:{}".format(HomeApi().new_product().json())) # print("分类:{}".format(ApiFactory.get_product().category().json())) # print("分类下商品:{}".format(ApiFactory.get_product().product().json())) # print("商品详情:{}".format(ApiFactory.get_product().product_detail().json())) # res = ApiFactory.get_user().token_api().json() # print("token:{}".format(res)) # app.header["token"] = res.get("token") # print("app:{}".format(app.header)) # # print("verify:{}".format(ApiFactory.get_user().verify_api().json())) # # print("address:{}".format(ApiFactory.get_user().address_api().json())) print("下单:{}".format(ApiFactory.get_order().create_api().json())) print("查询订单:{}".format(ApiFactory.get_order().query_api().json())) print("用户订单:{}".format(ApiFactory.get_order().user_api().json()))