示例#1
0
 def test_b001_search(self):
     conn = MySQL().connect_portal1('conn')
     cur = conn.cursor()
     cur.execute("select partner_name from partner where `status`=0")
     parnername = str(cur.fetchone()[0])
     url_01 = 'http://admin.ejw.cn/portal/v1/partners?sort=%7B%22gmtCreate%22%3A%22desc%22%7D&status=0&pageNo=1&pageSize=10&partnerName='
     url = url_01+parnername
     # 发送服务商接口请求
     qykh_test_01 = requests.get(url, headers=headers)
     qykh_test = qykh_test_01.text
     # 判断当前返回码及字段值
     self.assertIn(parnername, qykh_test, msg="没有查询到此用户信息")
示例#2
0
 def test_c007_product_verify(self):
     # 连接ps数据库
     conn1 = MySQL().connect_ps1('conn')
     cur1 = conn1.cursor()
     cur1.execute(
         "select uuid from product t where t.partner_id=190 and t.partner_type=0010 and sale_flag=0 order by create_time desc")
     products = cur1.fetchone()[0]
     url = "http://sp.ejw.cn/platform/v1/productauth"
     params = {"authType": 1, "spId": "190", "cpId": "190", "products": [products]}
     product_verify = requests.post(url, data=json.dumps(params), headers=headers)
     if product_verify.status_code == 200:
         print("授权成功")
     else:
         print("授权失败")
示例#3
0
 def test_c001_product_search(self):
     conn = MySQL().connect_ps1('conn')
     cur = conn.cursor()
     cur.execute("select t.product_name from product t where t.partner_type=0010 and sale_flag=1 and partner_id=190")
     product_name = cur.fetchone()[0]
     url_01 = "http://sp.ejw.cn/sp/v1/sproductauth?partnerId=190&cpPartnerId=&productType=&productName="
     url = url_01 + product_name
     product_search = requests.get(url, headers=headers)
     product_name_act = json.loads(product_search.text)["products"][0]["partnerName"]
     # print(product_name_act)
     if product_name == product_name_act:
         print("# 店铺管理-产品管理-产品上下架管理-发布产品-产品名称查询: 产品信息查询成功")
     else:
         print("# 店铺管理-产品管理-产品上下架管理-发布产品-产品名称查询: 该服务商没有相应的产品,请先新增产品再发布")
示例#4
0
 def test_c004_product_verify(self):
     conn = MySQL().connect_platform1('conn')
     cur = conn.cursor()
     cur.execute(
         "select verify_id from product_verify where partner_id=190 and product_type='group' ORDER BY gmt_modified desc")
     url_02 = str(cur.fetchone()[0])
     url_01 = "http://sp.ejw.cn/platform/v1/productverify/"
     url = url_01 + url_02
     product_search = requests.delete(url, headers=headers)
     product_name_act = json.loads(product_search.text)
     print(product_name_act)
     if product_name_act == 1:
         print("# 店铺管理-产品管理-产品上下架管理-发布产品审核取消: 已取消审核邀请")
     else:
         print("# 店铺管理-产品管理-产品上下架管理-发布产品审核取消: 取消审核中断")
示例#5
0
 def test_c003_product_verify(self):
     conn = MySQL().connect_ps1('conn')
     cur = conn.cursor()
     cur.execute(
         "select uuid from product t where t.partner_id=190 and t.partner_type=0100 order by create_time desc;")
     product_id = cur.fetchone()[0]
     url = "http://sp.ejw.cn/sp/v1/productverify"
     params = {"partnerId": 190, "productId": product_id, "productType": "group", "verifyType": 1,
               "createUser": 24, "partnerType": "0100"}
     product_search = requests.post(url, data=json.dumps(params), headers=headers)
     product_name_act = json.loads(product_search.text)
     print(product_name_act)
     if product_name_act == 1:
         print("# 店铺管理-产品管理-产品上下架管理-发布产品审核: 已发送审核邀请")
     else:
         print("# 店铺管理-产品管理-产品上下架管理-发布产品审核: 审核中断")
示例#6
0
 def test_d002_spsq_dsh(self):
     conn = MySQL().connect_platform1('conn')
     cur = conn.cursor()
     cur.execute('select verify_id,product_id from product_verify where `status` = 0')
     cur_data = cur.fetchone()[0:2]
     verify_id = str(cur_data[0])
     product_id = cur_data[1]
     print(verify_id, product_id)
     url_01 = 'http://admin.ejw.cn/platform/v1/productverify/'
     url = url_01 + verify_id
     paramas = {"status": 1}
     result = requests.put(url, data=json.dumps(paramas), headers=headers)
     result_exp = 200
     result_act = result.status_code
     self.assertEqual(result_exp, result_act)
     print("产品审核通过")
示例#7
0
 def test_d001_spsq_dsh(self):
     conn = MySQL().connect_platform1('conn')
     cur = conn.cursor()
     cur.execute('select record_id,auth_id from product_auth where `status`= 3')
     cur_data = cur.fetchone()[0:2]
     record_id = str(cur_data[0])
     auth_id = cur_data[1]
     # print(record_id, auth_id)
     url_01 = 'http://admin.ejw.cn/platform/v1/productauth/'
     url = url_01 + record_id + '/platformverify'
     paramas = {"status": 5}
     result = requests.put(url, data=json.dumps(paramas), headers=headers)
     result_exp = 200
     result_act = result.status_code
     self.assertEqual(result_exp, result_act)
     print("产品授权通过")
示例#8
0
 def test_a004_search(self):
     conn = MySQL().connect_os1('conn')
     cur = conn.cursor()
     cur.execute("select partner_name from partner")
     parnername = str(cur.fetchone()[0])
     url_01 = 'http://admin.ejw.cn/os/v1/partners?pageSize=10&pageNo=1&partnerType=0010%2C0011%2C0100%2C0101%2C0111%2C0110&partnerName='
     url = url_01+parnername
     # 发送服务商接口请求
     qykh_test_01 = requests.get(url, headers=headers)
     qykh_test = qykh_test_01.text
     # 返回状态码信息
     totalCount = qykh_test.split("startRow", 2)[1].split(",", 2)[1].split(":", 2)[1]
     # 判断当前返回码及字段值
     result_act = int(totoalCount)
     result_exp = 1
     self.assertEqual(result_exp, result_act, "查询的日志结果不一致")
示例#9
0
 def test_a003_role_del(self):
     conn = MySQL().connect_mall1('conn')
     cur = conn.cursor()
     sql_data = '190'
     # 查询出当前要删除案例的id信息
     cur.execute('select case_name from class_case_info t where t.sp_id = "' + sql_data + '"')
     total = str(cur.fetchall()[0][0])
     print(total)
     url_01 = 'http://sp.ejw.cn/mall/v1/classcaseinfos?spId=190&caseState=&pageSize=10&pageNo=1&caseName='
     url = url_01 + total
     print(url)
     case_search_act = requests.get(url, headers=headers).text
     print(type(case_search_act))
     if total in case_search_act:
         print("案例名称查询信息成功")
     else:
         print("案例名称查询信息失败")
示例#10
0
 def test_c010_product_verify(self):
     conn = MySQL().connect_platform1('conn')
     cur = conn.cursor()
     cur.execute("select cp_id,auth_id from product_auth where sp_id=190")
     product_name = str(cur.fetchone()[0])
     product_name_01 = str(cur.fetchone()[1])
     print(product_name_01)
     url_01 = "http://sp.ejw.cn/os/v1/partners?partnerId="
     url = url_01+product_name
     try:
         product_seach = requests.get(url, headers=headers).status_code
         if product_seach == 200:
             print("授权单号"+product_name_01+"查询正常")
         else:
             print("授权单号"+product_name_01+"没有查询到该信息")
     except:
         print("查询数据列表为空")
示例#11
0
 def test_c005_product_serach(self):
     conn = MySQL().connect_ps1('conn')
     cur = conn.cursor()
     cur.execute(
         "select product_name from product t where t.partner_id=190 and t.partner_type=0100 order by create_time desc")
     productName = str(cur.fetchone()[0])
     url_01 = "http://sp.ejw.cn/sp/v1/sp/190/products?productType=&pageSize=10&pageNo=1&productName="
     url = url_01 + productName
     print(url)
     product_search = requests.get(url, headers=headers)
     # print(product_search.text)
     product_name_act = json.loads(product_search.text)["products"][0]["productName"]
     # print(type(product_name_act))
     if product_name_act == productName:
         print(productName+'查询成功')
     else:
         print(productName+'查询失败')
示例#12
0
 def test_b003_jn_search(self):
     conn = MySQL().connect_mall1('conn')
     cur = conn.cursor()
     sql_data = '190'
     # 查询出当前要删除案例的id信息
     cur.execute('select policy_Name from marketing_policy t where t.sp_id = "' + sql_data + '"')
     total = str(cur.fetchall()[0][0])
     # print(total)
     url_01 = 'http://sp.ejw.cn/mall/v1/marketingpolicys?spId=190&policyState=&pageNo=1&pageSize=10&policyName='
     url = url_01 + total
     # print(url)
     case_search_act = requests.get(url, headers=headers).text
     # print(type(case_search_act))
     if total in case_search_act:
         print("案例名称查询信息成功")
     else:
         print("案例名称查询信息失败")
示例#13
0
 def test_b002_jn_del(self):
     conn = MySQL().connect_mall1('conn')
     cur = conn.cursor()
     sql_data = '190'
     # 查询出当前要删除案例的id信息
     cur.execute('select policy_id from marketing_policy t where t.sp_id = "' + sql_data + '"')
     total = str(cur.fetchall()[0][0])
     # print(total)
     url_01 = 'http://sp.ejw.cn/mall/v1/marketingpolicy/'
     url = url_01 + total
     # print(url)
     case_delete_act = requests.delete(url, headers=headers).text
     # print(type(case_delete_act))
     case_delete_exp = 1
     if case_delete_exp == int(case_delete_act):
         print("案例删除成功")
     else:
         print("案例删除失败")
示例#14
0
 def test_b005_search(self):
     conn = MySQL().connect_os1('conn')
     cur = conn.cursor()
     cur.execute("select partner_id, partner_name from partner where `status`=0 and partner_type=0001")
     cur_data = cur.fetchone()[0:2]
     # print(cur_data)
     partner_id = str(cur_data[0])
     partner_name = cur_data[1]
     print(partner_id, partner_name)
     paramas = {"status": 1}
     url_01 = 'http://admin.ejw.cn/platform/v1/partner/'
     url = url_01 + partner_id + '/status'
     # 发送服务商接口请求
     shtg = requests.put(url, data=json.dumps(paramas), headers=headers)
     # requests.get("http://admin.ejw.cn/os/v1/partners?sort=%7B%22gmtCreate%22%3A%22desc%22%7D&pageSize=10&pageNo=1&partnerType=0001%2C0011%2C0101%2C0111", headers=headers)
     result_exp = 200
     result_act = shtg.status_code
     self.assertEqual(result_exp, result_act, msg=企业审核不通过)
示例#15
0
    def test_b003_search(self):
        # 随机生成社会信用代码
        uscCode_01 = ''.join(random.sample(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 10))
        uscCode_02 = '43062419'
        uscCode = uscCode_01 + uscCode_02

        conn = MySQL().connect_portal1('conn')
        cur = conn.cursor()
        cur.execute("select partner_id,partner_name,area,address,phone from partner where `status`=0")
        cur_data = cur.fetchone()[0:5]
        partner_id = str(cur_data[0])
        partner_name = cur_data[1]
        area = cur_data[2]
        address = cur_data[3]
        phone = cur_data[4]
        # print(cur_data, partner_id, partner_name, area, address, phone)

        paramas = {"partnerAudit": {"status": 1, "auditUser": 13},
                   "partner": {"status": 1, "partnerName": partner_name, "area": area, "address": address,
                               "phone": phone,
                               "detail": "", "organizeType": 1, "partnerType": "0001"},
                   "partnerExt": {"standardIndustry": "612"},
                   "partnerQualify": {"qualifyType": 1, "qualifyName": partner_name,
                                      "qualifyValidDate": "2019-05-31T00:00:00+08:00",
                                      "qualifyImage": "https://bj.bcebos.com/v1/dev-con/4c62757db4204f33907aa7eb43c1d6bd.jpg"},
                   "employees": {"status": 1, "sex": 1, "empName": "威胜管理员", "phone": "15074980908", "email": "",
                                 "partnerId": 4},
                   "partnerBusiness": {"organizeName": "威胜电子", "registAuthority": "岳麓区地点", "organizeType": 1,
                                       "uscCode": uscCode, "companyType": "1", "registAddress": "长沙岳麓区",
                                       "legalPerson": "楼想",
                                       "scope": "长沙岳麓区", "issueAuthority": "",
                                       "approvalDate": "2020-05-09T00:00:00+08:00",
                                       "registStatus": "1", "registCapital": 5000}}

        url_01 = 'http://admin.ejw.cn/platform/v1/partner/'
        url = url_01 + partner_id + '/audit'
        # 发送服务商接口请求
        qykh_test_01 = requests.put(url, data=json.dumps(paramas), headers=headers)
        result_act = qykh_test_01.status_code
        result_exp = 200
        # 判断当前返回码及字段值
        self.assertEqual(result_exp, result_act, msg='审核不通过')
示例#16
0
 def test_a002_role_del(self):
     # 设置案例名称
     caseName_01 = ''.join(random.sample(['8', '6', '3', '2', '5', '6'], 4))
     caseName_02 = '案例生成'
     caseName = caseName_02 + caseName_01
     conn = MySQL().connect_mall1('conn')
     cur = conn.cursor()
     sql_data = '190'
     # 查询出当前要删除案例的id信息
     cur.execute('select case_id from class_case_info t where t.sp_id = "' + sql_data + '"')
     total = str(cur.fetchall()[0][0])
     print(total)
     url_01 = 'http://sp.ejw.cn/mall/v1/classcaseinfo/'
     url = url_01 + total
     print(url)
     case_delete_act = requests.delete(url, headers=headers).text
     print(case_delete_act)
     case_delete_exp = 1
     if case_delete_exp == case_delete_act:
         print("案例删除成功")