Пример #1
0
 def test_a001(self):
     token = Zpt().cu_login()
     headers = {
         'Content-Type': 'application/json;charset=UTF-8',
         'token': token
     }
     conn = MySQL.connect_mall()
     cur = conn.cursor()
     sql = "select t.product_uuid, t.product_spec_uuid from shoping_info t where t.sp_id=" + spId + " and emp_id=" + \
           cuEmpId
     cur.execute(sql)
     sql_result = cur.fetchone()[0:2]
     productUuid = sql_result[0]
     productSpecUuid = sql_result[1]
     url = "http://www.ejw.cn/shopingcart/" + cuComId
     params = {
         "productUuid": productUuid,
         "productSpecUuid": productSpecUuid,
         "spId": int(spId),
         "compId": int(cuComId),
         "empId": int(cuEmpId)
     }
     result = requests.post(url, data=json.dumps(params), headers=headers)
     result_exp = 200
     # print(result_exp_pro, result_act_pro)
     self.assertEqual(result_exp, result.status_code, msg="请求参数异常或加入购物车失败")
     print("外商城商品加入购物车成功", result.text)
Пример #2
0
 def test_b001_shop(self):
     conn = MySQL.connect_mall()
     cur = conn.cursor()
     sql = "select t.product_uuid, t.product_spec_uuid from shoping_info t where t.sp_id=" + spId + " and emp_id=" + \
           cuEmpId
     cur.execute(sql)
     sql_result = cur.fetchone()[0:2]
     productUuid = sql_result[0]
     productSpecUuid = sql_result[1]
     url = "http://www.ejw.cn/shopingcart/" + cuComId
     params = {"productUuid": productUuid, "productSpecUuid": productSpecUuid,
               "spId": int(spId),
               "compId": int(cuComId), "empId": int(cuEmpId)}
     result = requests.post(url, data=json.dumps(params), headers=headers).text
     result_exp_pro = "01541123570722"
     # print(result_exp_pro, result_act_pro)
     self.assertIn(result_exp_pro, result, msg="请求参数异常或加入购物车失败")
     log.info("外商城商品加入购物车")
     log_exp.info(result_exp_pro)
     log_act.info(result)
Пример #3
0
adminEmpId = localReadConfig.read_admin_emp_id()
spId = localReadConfig.read_sp_com_id()

# # coding:utf-8
# a = [1, 3, 5, 7, 0, -1, -9, -4, -5, 8]
#
# # 用列表生成式,生成新的列表
# b = [i for i in a if i > 0]
# print(b)
# print("大于0的个数:%s" % len(b))
#
# # 字符串切片
# a = "axbyczdjf"
# print(a[::2])

conn = MySQL.connect_mall()
cur = conn.cursor()
sql = "select t.product_uuid, t.product_spec_uuid from shoping_info t where t.sp_id=" + spId + " and emp_id=" + \
      cuEmpId
cur.execute(sql)
sql_result = cur.fetchone()[0:2]
productUuid = sql_result[0]
productSpecUuid = sql_result[1]
url = "http://www.ejw.cn/shopingcart/" + cuComId
params = {"productUuid": productUuid, "productSpecUuid": productSpecUuid,
          "spId": int(spId),
          "compId": int(cuComId), "empId": int(cuEmpId)}
print(params)