def test_view_order(self): """查看订单""" # 订单id order_id = 120 # 收件人姓名 exp_name = '小乔' # 收件人手机号 exp_mobile = '13588888888' # 响应对象 res = ApiFactory.get_order_api().query_order_api(order_id) # 打印 请求参数、请求地址、请求响应数据 logging.info('请求地址:{}'.format(res.url)) logging.info('请求响应:{}'.format(res.json())) # 断言响应状态码 utils.common_assert(res) # 断言订单编号 assert res.json().get('id') == order_id # 断言地址 用户名 和 手机号 assert res.json().get('snap_address').get('name') == exp_name assert res.json().get('snap_address').get('mobile') == exp_mobile # 断言关键字 assert False not in [ i in res.text for i in [ 'order_no', 'total_price', 'snap_img', 'snap_name', 'total_count' ] ]
def test_get_order_list(self): """获取订单列表""" res = ApiFactory.get_order_api().get_order_list_api() # 打印请求地址 打印请求参数 打印请求响应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言状态码 assert res.status_code == 200 # 断言关键字 assert False not in [i in res.text for i in ["id", "order_no", "create_time", "total_price"]]
def test_order_list(self): """订单列表""" res = ApiFactory.get_order_api().order_list_api(1) logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言响应状态码 utils.common_assert_code(res) # 断言关键词 assert False not in [ i in res.text for i in ["current_page", "data", "snap_name"] ]
def test_create_order(self): """创建订单""" product_id = 12 count = 7 res = ApiFactory.get_order_api().create_order_api(product_id, count) logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言状态码 utils.common_assert_code(res) # 断言用户no 和id 字段大于等于0 assert len(res.json().get("order_no")) and len( res.json().get("order_id"))
def test_query_order(self): """查询订单""" # 订单id order_id = 115 # 响应对象 res = ApiFactory.get_order_api().query_order_api(order_id) # 断言 状态码 untils.common_assert_code(res) # 断言订单id assert res.json().get("id") == 115 # 断言地址 用户名 手机号 assert res.json().get("snap_address").get("name") == "大大" assert res.json().get("snap_address").get("mobile") == "13888888888"
def test_query_order(self): """查询订单""" # 订单id order_id = 119 # 响应对象 res = ApiFactory.get_order_api().query_order_api(order_id) # 打印请求地址,请求参数,请求响应数据 logging.info(f"请求地址:{res.url}") logging.info(f"请求地址:{res.json()}") # 断言 状态码 utils.common_assert_code(res) # 断言订单id assert res.json().get("id") == 119 # 断言地址 用户名 手机号 assert res.json().get("snap_address").get("name") == "大王" assert res.json().get("snap_address").get("mobile") == "13788888888"
def test_order_list(self): """订单列表""" # 响应对象 res = ApiFactory.get_order_api().order_list_api() # 打印请求地址,请求参数,请求响应数据 logging.info(f"请求地址:{res.url}") logging.info(f"请求地址:{res.json()}") # 断言状态码 utils.common_assert_code(res) # 断言页面是否是第一个 assert res.json().get("current_page") == 1 # 断言订单数据大于0,更具用户数据决定 assert len(res.json()) > 0 # 断言关键字段 assert False not in [ i in res.text for i in ["id", "order_no", "total_price"] ]
def test_create_order(self): """创建订单""" # 购买商品id 、数量 product_id = 15 count = 2 # 响应对象 res = ApiFactory.get_order_api().create_order_api(product_id, count) # 打印 请求参数、请求地址、请求响应数据 logging.info('请求地址:{}'.format(res.url)) logging.info('请求响应:{}'.format(res.json())) # 断言响应状态码 utils.common_assert(res) # 断言 order_no和order_id 存在 assert len(res.json().get('order_no')) > 0 and len( res.json().get('order_id')) > 0 # 断言订单状态 assert res.json().get('pass') is True
def test_order_list_api(self): """订单列表""" res = ApiFactory.get_order_api().order_list_api() # 打印请求地址,打印请求参数 打印响应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言状态码 utils.common_assert_code(res, 200) # 断言订单数量大于0 assert len(res.json().get('data')) > 0 # 断言包含关键字段 assert False not in [ i in res.text for i in ['id', 'order_no', 'create_time', 'total_price'] ] # 断言current_page的值 assert res.json().get('current_page') == 1
def test_order_list(self): """订单列表""" # 响应对象 res = ApiFactory.get_order_api().order_list_api() # 断言 状态码 untils.common_assert_code(res) # 断言页面是否是第一个 assert res.json().get("current_page") == 1 # 断言 订单数据大于0 根据用户数据决定 assert len(res.json()) > 0 # 断言关键字段 assert False not in [ i in res.text for i in ["id", "order_no", "total_price"] ]
def test_order_api(self): """创建订单""" # 商品id product_id = 7 # 购买数量 count = 3 # 响应对象 res = ApiFactory.get_order_api().create_order_api(product_id, count) # 打印请求地址,请求参数,请求响应数据 logging.info(f"请求地址:{res.url}") logging.info(f"请求地址:{res.json()}") # 断言 状态码 utils.common_assert_code(res) # 订单编号 和 订单id 不为空 assert len(res.json().get("order_no")) > 0 and len( res.json().get("order_id")) > 0 # 断言订单是否通过 assert res.json().get("pass") is True
def test_create_order_api(self): """创建订单""" res = ApiFactory.get_order_api().create_order_api(12, 1) # 打印请求地址,打印请求参数 打印响应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言响应状态码 utils.common_assert_code(res, 200) # 断言包含关键字段 assert False not in [ i in res.text for i in ['order_id', 'order_no', 'create_time', 'pass'] ] # 断言pass的值为True assert res.json().get('pass') is True # 订单编号和订单id大于0 assert len(res.json().get('order_no')) > 0 and len( res.json().get('order_id')) > 0
def test_query_order(self): """查看订单""" # 订单id order_id = 115 # 预期结果 exp_name = "李李" exp_mobile = "13700000001" res = ApiFactory.get_order_api().query_order_api(order_id) logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言状态码 utils.common_assert_code(res) # 断言订单id assert res.json().get("id") == 115 # 断言地址 用户名 手机号 assert res.json().get("snap_address").get("name") == exp_name assert res.json().get("snap_address").get("mobile") == exp_mobile
def test_order_list(self): """用户订单列表""" # 响应对象 res = ApiFactory.get_order_api().order_list_api() # 打印 请求参数、请求地址、请求响应数据 logging.info('请求地址:{}'.format(res.url)) logging.info('请求响应:{}'.format(res.json())) # 断言响应状态码 utils.common_assert(res) # 断言当前页面 assert res.json().get('current_page') == 1 # 断言 订单数量大于0 assert len(res.json().get('data')) > 0 # 断言关键字 assert False not in [ i in res.text for i in ['id', 'order_no', 'total_price', 'total_count'] ]
def test_order_list(self): """订单列表""" # 响应对象 res = ApiFactory.get_order_api().order_list_api() # 打印 请求地址 打印请求参数 打印请求响应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言 utils.common_assert_code(res) # 断言页面是否是第一个 assert res.json().get("current_page") == 1 # 断言 订单数据大于0 根据用户数据决定 assert len(res.json()) > 0 # 断言关键字段 assert False not in [ i in res.text for i in ["id", "order_no", "total_price"] ]
def test_order_api(self): """创建订单""" # 商品id product_id = 7 # 购买数量 count = 3 # 响应对象 res = ApiFactory.get_order_api().create_order_api(product_id, count) # 断言 状态码 untils.common_assert_code(res) # 订单编号 和 订单id 不为空 assert len(res.json().get("order_no")) > 0 and len( res.json().get("order_id")) > 0 # 断言订单是否通过 assert res.json().get("pass") is True
def test_query_order(self): """查询订单""" # 订单id order_id = 115 # 响应对象 res = ApiFactory.get_order_api().query_order_api(order_id) # 打印 请求地址 打印请求参数 打印请求响应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言 状态码 utils.common_assert_code(res) # 断言订单id assert res.json().get("id") == 115 # 断言地址 用户名 手机名 assert res.json().get("snap_address").get("name") == "小敏" assert res.json().get("snap_address").get("mobile") == "13914151111"
def test_query_order_pai(self): """订单详情""" res = ApiFactory.get_order_api().query_order_pai(112) # 打印请求地址,打印请求参数 打印响应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言响应状态码 utils.common_assert_code(res, 200) # 断言包含关键字段 assert False not in [ i in res.text for i in ['id', 'order_no', 'snap_items', 'snap_name'] ] # 断言snap_items大于0 assert len(res.json().get('snap_items')) > 0 # 断言id assert res.json().get('id') == 112 # 断言地址信息 assert res.json().get('snap_address').get('name') == '肖肖' assert res.json().get('snap_address').get('mobile') == '13862812345'
def test_order_api(self): """创建订单""" # 商品id product_id = 7 # 购买数量 count = 3 # 响应对象 res = ApiFactory.get_order_api().create_order_api(product_id, count) # 打印请求地址 打印请求参数 打印请求相应数据 logging.info("请求地址:{}".format(res.url)) logging.info("响应数据:{}".format(res.json())) # 断言 状态码 utils.common_assert_code(res, 200) # 订单编号 和 订单id 不为空 assert len(res.json().get("order_no")) > 0 and len(res.json().get("order_id")) > 0 # 断言订单是否通过 assert res.json().get("pass") is True
# # # 调用主题 # print("主题:{}".format(ApiFactory.get_home_api().theme_api().json())) # # # 调用最近新品 # print("最近新品:{}".format(ApiFactory.get_home_api().recent_product_api().json())) # # 获取商品分类 # print("商品分类:{}".format(ApiFactory.get_product_api().get_product_classify().json())) # # # 获取商品分类下商品 # print("商品分类:{}".format(ApiFactory.get_product_api().get_products_goods().json())) # # # 获取商品信息 # print("商品分类:{}".format(ApiFactory.get_product_api().get_product_info().json())) # 获取token # print("获取的token:{}".format(ApiFactory.get_user_api().get_token_api().json())) # 验证token # print("验证获取的token:{}".format(ApiFactory.get_user_api().token_verify_api().json())) # # #获取位置信息 # print("验证获取的token:{}".format(ApiFactory.get_user_api().get_adress_info_api().json())) # 获取订单列表 print("创建订单:{}".format(ApiFactory.get_order_api().get_order_list_api().json())) # 创建订单 print("创建订单:{}".format(ApiFactory.get_order_api().create_list_api().json())) # 查看订单 print("创建订单:{}".format(ApiFactory.get_order_api().look_list_api().json()))
from Api.apiFactory import ApiFactory # # 调用轮播图 # print("轮播图:{}".format(ApiFactory.get_home_api().banner_api().json())) # # # 调用专题栏 # print("专题栏:{}".format(ApiFactory.get_home_api().theme_api().json())) # # # 调用最新新品 # print("最新新品:{}".format(ApiFactory.get_home_api().recent_product_api().json())) # # 调用商品分类 # print("商品分类:{}".format(ApiFactory.get_product_api().product_classify_api().json())) # # # 调用分类下商品 # print("分类下商品:{}".format(ApiFactory.get_product_api().classify_product_api().json())) # # # 调用商品信息 # print("商品信息:{}".format(ApiFactory.get_product_api().product_detail_api().json())) # print("token:{}".format(ApiFactory.get_user_api().get_token_api().json())) # 调用订单列表 print("订单列表:{}".format(ApiFactory.get_order_api().order_list_api().json())) print("创建订单:{}".format(ApiFactory.get_order_api().create_order_api(12, 7).json())) print("订单详细:{}".format(ApiFactory.get_order_api().query_order_api(117).json()))
from Api.apiFactory import ApiFactory # # 调用轮播图api # print("轮播图:{}".format(ApiFactory.get_home_api().banner_api().json())) # # 调用专题栏api # print("专题栏:{}".format(ApiFactory.get_home_api().theme_api().json())) # # 调用最近新品api # print("最近新品:{}".format(ApiFactory.get_home_api().recent_product_api().json())) # # 调用商品分类 # print("商品分类:{}".format(ApiFactory.get_product_api().product_classify_api().json())) # # 分类下的商品 # print("分类下的商品:{}".format(ApiFactory.get_product_api().classify_product_api().json())) # # 商品信息 # print("商品信息:{}".format(ApiFactory.get_product_api().product_detail_api().json())) # 调用用户获取token # print("返回值:{}".format(ApiFactory.get_user_api().get_token_api().json())) print("获取订单列表:{}".format( ApiFactory.get_order_api().get_order_list_api().json())) print("创建订单:{}".format(ApiFactory.get_order_api().create_order_api(9, 4).json())) print("查看订单:{}".format(ApiFactory.get_order_api().query_order_api(110).json()))
from Api.apiFactory import ApiFactory # # 调用轮播图api # print(f'轮播图:{ApiFactory.get_home_api().banner_api().json()}') # # # 调用主题 # print('调用主题:{}'.format(ApiFactory.get_home_api().theme_api().json())) # # # 调用最近新品 # print('最近新品:{}'.format(ApiFactory.get_home_api().recent_product_api().json())) # 调用商品分类 # print('商品分类:{}'.format(ApiFactory.get_product_api().product_classify_api().json())) # print('分类商品:{}'.format(ApiFactory.get_product_api().clssify_product_api().json())) # print('商品信息:{}'.format(ApiFactory.get_product_api().product_info_api().json())) # print('获取token:{}'.format(ApiFactory.get_user_api().get_token_api().json())) print('订单列表:{}'.format(ApiFactory.get_order_api().order_list_api().json())) print('创建订单:{}'.format(ApiFactory.get_order_api().create_order_api(12, 7).json())) print('查询订单:{}'.format(ApiFactory.get_order_api().query_order_api(109).json())) print('订单列表:{}'.format(ApiFactory.get_order_api().order_list_api().json()))
from Api.apiFactory import ApiFactory # 实例化HomeApi # # 调用轮播图 # print("轮播图:{}".format(ApiFactory.get_home_api().banner_api().json())) # # 调用主题 # print("主题:{}".format(ApiFactory.get_home_api().theme_api().json())) # # 调用最近新品 # print("最近新品:{}".format(ApiFactory.get_home_api().recent_product_api().json())) # 调用商品分类 # print("分类:{}".format(ApiFactory.get_product_api().product_classify_api().json())) # # 调用分类下商品 # print("分类下商品:{}".format(ApiFactory.get_product_api().classify_product_api().json())) # # 调用商品信息 # print("商品信息:{}".format(ApiFactory.get_product_api().product_detail_api(26).json())) # 获取token # print("返回值:{}".format(ApiFactory.get_user_api().get_token_api().json())) # print("用户名{}".format(ApiFactory.get_user_api().user_address_api().json())) print("查看订单:{}".format(ApiFactory.get_order_api().order_list_api().json())) print("创建订单:{}".format(ApiFactory.get_order_api().create_order_api(12, 7).json())) print("查看订单:{}".format(ApiFactory.get_order_api().query_order_api(71).json()))
from Api.apiFactory import ApiFactory # print(ApiFactory.get_home_api().banner_api().json()) # # print(ApiFactory.get_home_api().theme_api().json()) # # print(ApiFactory.get_home_api().product_recent_api().json()) # print(ApiFactory.get_product_api().product_classify_api().json()) # print(ApiFactory.get_product_api().classify_product_api(5).json()) # print(ApiFactory.get_product_api().product_detail_api(26).json()) # print(ApiFactory.get_user_api().token_user_api().json()) print(ApiFactory.get_order_api().order_list_api().json()) print(ApiFactory.get_order_api().create_order_api(12, 1).json()) print(ApiFactory.get_order_api().query_order_pai(99).json())