Ejemplo n.º 1
0
 def test_PlayerRegist03(self):
     """验证手机验证码注册:多个在有效期内验证码,输入最新的"""
     mobile = 19925757099
     code1 = OpenPlatformCommon.get_smscode(mobile=mobile)
     code2 = OpenPlatformCommon.get_smscode(mobile=mobile)
     datas = {
         "type": 2,
         "channelNo": 81026962,
         "packageNo": 81026962001,
         "ip": "58.63.60.133",
         "machineCode": "autotest8888",
         "appId": "8103xqzESJOPvBzwHikLWwTXHfF6iZzE",
         "terminalType": 1,
         "osVersion": "Android.8.3.1",
         "machineModel": "MI 9",
         "payload": {
             "Mobile": mobile,
             "SmsKey": "1",
             "SmsCode": code2
         },
         "networkState": 0,
         "wifiName": "MISnet"
     }
     params = json.dumps(datas)
     headers = {'Content-Type': "application/json"}
     res = self.client.send(data=params, headers=headers)
     res_success = JMESPathExtractor().extract(query='success',
                                               body=res.text)
     res_message = JMESPathExtractor().extract(query='message',
                                               body=res.text)
     res_error = JMESPathExtractor().extract(query='error', body=res.text)
     res_code = JMESPathExtractor().extract(query='code', body=res.text)
     responseTime = JMESPathExtractor().extract(query='responseTime',
                                                body=res.text)
     res_data = JMESPathExtractor().extract(query='data', body=res.text)
     res_openId = JMESPathExtractor().extract(query='data.openId',
                                              body=res.text)
     res_unionId = JMESPathExtractor().extract(query='data.unionId',
                                               body=res.text)
     res_nickname = JMESPathExtractor().extract(query='data.nickname',
                                                body=res.text)
     res_account = JMESPathExtractor().extract(query='data.account',
                                               body=res.text)
     res_password = JMESPathExtractor().extract(query='data.password',
                                                body=res.text)
     res_picture = JMESPathExtractor().extract(query='data.picture',
                                               body=res.text)
     msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text
     self.assertTrue(res_success, msg=msg)
     self.assertIsNone(res_error, msg=msg)
     self.assertEqual(0, res_code, msg=msg)
     self.assertGreater(len(res_openId), 0, msg=msg)
     self.assertGreater(len(res_unionId), 0, msg=msg)
     self.assertIn('游客', res_nickname, msg=msg)
     self.assertEqual(str(mobile), res_account, msg=msg)
     self.assertEqual(18, len(res_password), msg=msg)
Ejemplo n.º 2
0
 def test_PlayerLogin03(self):
     """验证手机验证码登录:多个在有效期内验证码,输入最新的"""
     mobile = 17712345678
     code1 = OpenPlatformCommon.get_smscode(mobile=mobile)
     code2 = OpenPlatformCommon.get_smscode(mobile=mobile)
     datas = {
         "channelNo": 81026962,
         "packageNo": 81026962001,
         "type": 1,
         "ip": "58.63.60.71",
         "machineCode": "s0qO3Jz9TLeM2CtQ50x",
         "appId": "8102Fv0aBOMJ5lbt6mMSrqBSPE7cpI8A",
         "terminalType": 1,
         "osVersion": "Android.8.3.1",
         "machineModel": "MI 9",
         "payload": {
             "Mobile": mobile,
             "SmsKey": "1",
             "SmsCode": code2
         },
         "networkState": 0,
         "wifiName": "MISnet"
     }
     params = json.dumps(datas)
     headers = {'Content-Type': "application/json"}
     res = self.client.send(data=params, headers=headers)
     res_success = JMESPathExtractor().extract(query='success',
                                               body=res.text)
     res_message = JMESPathExtractor().extract(query='message',
                                               body=res.text)
     res_error = JMESPathExtractor().extract(query='error', body=res.text)
     res_code = JMESPathExtractor().extract(query='code', body=res.text)
     responseTime = JMESPathExtractor().extract(query='responseTime',
                                                body=res.text)
     res_data = JMESPathExtractor().extract(query='data', body=res.text)
     res_openId = JMESPathExtractor().extract(query='data.openId',
                                              body=res.text)
     res_nickname = JMESPathExtractor().extract(query='data.nickname',
                                                body=res.text)
     res_account = JMESPathExtractor().extract(query='data.account',
                                               body=res.text)
     res_mobile = JMESPathExtractor().extract(query='data.mobile',
                                              body=res.text)
     res_picture = JMESPathExtractor().extract(query='data.picture',
                                               body=res.text)
     msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text
     self.assertTrue(res_success, msg=msg)
     self.assertIsNone(res_error, msg=msg)
     self.assertEqual(0, res_code, msg=msg)
     self.assertEqual('jpSeis_Pz8_Pz8_Hzs_NxsrHyMiHu76v',
                      res_openId,
                      msg=msg)
     self.assertEqual('游客23113470', res_nickname, msg=msg)
     self.assertEqual(str(mobile), res_account, msg=msg)
     self.assertEqual(str(mobile), res_mobile, msg=msg)
Ejemplo n.º 3
0
    def test_ProductModify01(self):
        """简单验证修改产品接口容错"""
        datas = ExcelReader(self.excel, sheet='ModifyProduct').data
        for d in range(0, len(datas)):
            if datas[d]['is_execute'] == 'N':
                continue
            else:
                with self.subTest(data=datas[d]['CaseNo'] +
                                  datas[d]['describe']):
                    self.setUp()
                    # logger.debug(datas[d])
                    expect = datas[d]['expect_code']
                    casename = str(datas[d]['describe'])
                    caseNo = str(datas[d]['CaseNo'])
                    #请求的参数剔除期望值列、是否执行列、描述列、用例编号列
                    datas[d].pop('expect_code')
                    datas[d].pop('is_execute')
                    datas[d].pop('describe')
                    datas[d].pop('CaseNo')
                    if datas[d]['productId'] == '{pid1-0}':
                        datas[d]['productId'] = OpenPlatformCommon.getpid(
                            self.mid, category=1, platform=0)
                    elif datas[d]['productId'] == '{pid1-1}':
                        datas[d]['productId'] = OpenPlatformCommon.getpid(
                            self.mid, category=1, platform=1)
                    elif datas[d]['productId'] == '{pid2}':
                        datas[d]['productId'] = OpenPlatformCommon.getpid(
                            self.mid, category=2)
                    elif datas[d]['productId'] == '{pid3}':
                        datas[d]['productId'] = OpenPlatformCommon.getpid(
                            self.mid, category=3)

                    datas[d]['settings'] = ast.literal_eval(
                        datas[d]['settings'])
                    # logger.debug(type(datas[d]['setting']))
                    # logger.debug(datas[d]['setting'])
                    #转换为json格式
                    # json.dumps(datas[d]['settings'])
                    params = json.dumps(datas[d])
                    # logger.debug(type(params))

                    headers = {'Content-Type': "application/json"}
                    res = self.client.send(data=params, headers=headers)
                    # resultlist =[caseNo,casename,params,expect,res.text]
                    # resultdata.qppend(resultlist)
                    # logger.debug(res.text)
                    result = JMESPathExtractor().extract(query='success',
                                                         body=res.text)
                    message = JMESPathExtractor().extract(query='message',
                                                          body=res.text)
                    msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text
                    self.assertEqual(expect, str(result).lower(), msg=msg)
                    self.assertNotIn('未知错误', str(message), msg=msg)
                    self.tearDown()
Ejemplo n.º 4
0
 def test_AdminGet01(self):
     """简单验证获取管理员信息接口容错"""
     datas = ExcelReader(self.excel, sheet='GetAdmin').data
     for d in range(0, len(datas)):
         if datas[d]['is_execute'] == 'N':
             continue
         else:
             with self.subTest(data=datas[d]['CaseNo'] +
                               datas[d]['describe']):
                 self.setUp()
                 # logger.debug(datas[d])
                 expect = datas[d]['expect_code']
                 casename = str(datas[d]['describe'])
                 caseNo = str(datas[d]['CaseNo'])
                 #请求的参数剔除期望值列、是否执行列、描述列、用例编号列
                 datas[d].pop('expect_code')
                 datas[d].pop('is_execute')
                 datas[d].pop('describe')
                 datas[d].pop('CaseNo')
                 if datas[d]['id'] == '{aid}':
                     datas[d]['id'] = OpenPlatformCommon.getaid(self.mid)[0]
                 res = self.client.sendbyurl(datas[d]['id'])
                 # resultlist =[caseNo,casename,params,expect,res.text]
                 # resultdata.qppend(resultlist)
                 # logger.debug(res.text)
                 result = JMESPathExtractor().extract(query='success',
                                                      body=res.text)
                 message = JMESPathExtractor().extract(query='message',
                                                       body=res.text)
                 msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text
                 self.assertEqual(expect, str(result).lower(), msg=msg)
                 self.assertNotIn('未知错误', str(message), msg=msg)
                 self.tearDown()
Ejemplo n.º 5
0
    def test_AdminGet02(self):
        """验证创建成功后获取管理员信息是否正确"""
        aid, account = OpenPlatformCommon.getaid(self.mid)

        date = time.strftime('%Y-%m-%d', time.localtime(time.time()))
        res = self.client.sendbyurl(aid)
        res_result = JMESPathExtractor().extract(query='success',
                                                 body=res.text)
        res_aid = JMESPathExtractor().extract(query='data.id', body=res.text)
        res_mid = JMESPathExtractor().extract(query='data.mId', body=res.text)
        res_loginaccount = JMESPathExtractor().extract(
            query='data.loginAccount', body=res.text)
        res_mobile = JMESPathExtractor().extract(query='data.mobile',
                                                 body=res.text)
        res_position = JMESPathExtractor().extract(query='data.position',
                                                   body=res.text)
        res_realname = JMESPathExtractor().extract(query='data.realName',
                                                   body=res.text)
        res_createtime = JMESPathExtractor().extract(query='data.createTime',
                                                     body=res.text)
        res_state = JMESPathExtractor().extract(query='data.state',
                                                body=res.text)
        res_type = JMESPathExtractor().extract(query='data.type',
                                               body=res.text)
        msg = '\n请求地址:' + res.url + '\n请求数据:' + aid + '\n返回结果:' + res.text
        self.assertEqual('true', str(res_result).lower(), msg=msg)
        self.assertEqual(self.mid, res_mid, msg=msg)
        self.assertEqual(aid, res_aid, msg=msg)
        self.assertEqual(account, res_loginaccount, msg=msg)
        self.assertEqual('None', str(res_mobile), msg=msg)
        self.assertEqual('', str(res_position), msg=msg)
        self.assertEqual('', str(res_realname), msg=msg)
        self.assertEqual('1', str(res_state), msg=msg)
        self.assertEqual('1', str(res_type), msg=msg)
        self.assertIn(date, str(res_createtime), msg=msg)
Ejemplo n.º 6
0
	def test_EditMerchant01(self):
		"""简单验证商户编辑接口容错"""
		datas = ExcelReader(self.excel,sheet='EditMerchant').data
		for d in range(0,len(datas)):
			if datas[d]['is_execute'] == 'N':
				continue
			else:
				with self.subTest(data=datas[d]['CaseNo']+datas[d]['describe']):
					self.setUp()
					# logger.debug(datas[d])
					expect = datas[d]['expect_code']
					casename = str(datas[d]['describe'])
					caseNo = str(datas[d]['CaseNo'])
					#请求的参数剔除期望值列、是否执行列、描述列、用例编号列
					datas[d].pop('expect_code')
					datas[d].pop('is_execute')
					datas[d].pop('describe')
					datas[d].pop('CaseNo')
					if datas[d]['id'] == '{mid}':
						datas[d]['id'] = OpenPlatformCommon.getmid()
					#转换为json格式
					params = json.dumps(datas[d])
					# logger.debug(type(params))
					headers={'Content-Type': "application/json"}
					res = self.client.send(data=params,headers=headers)
					# resultlist =[caseNo,casename,params,expect,res.text] 
					# resultdata.qppend(resultlist)				
					# logger.debug(res.text)
					result = JMESPathExtractor().extract(query='success', body=res.text)
					message = JMESPathExtractor().extract(query='message', body=res.text)
					msg = '\n请求地址:'+ res.url + '\n请求数据:' + params + '\n返回结果:' + res.text
					self.assertEqual(expect, str(result).lower(),msg=msg)
					self.assertNotIn('未知错误', str(message),msg=msg)
					self.tearDown()
Ejemplo n.º 7
0
 def test_ProductModify03(self):
     """验证修改产品成功时返回信息是否正确"""
     pid = OpenPlatformCommon.getpid(self.mid, category=3)
     datas = {
         "productId": pid,
         "name": "AutoTest修改测试",
         "iconUrl": "",
         "department": "",
         "introduction": "",
         "state": 2,
         "settings": {
             "packageName": "AutoTest",
             "signature": "AutoTest",
             "smallProgramId": "AutoTestEdit",
             "smallPlatformType": 0
         }
     }
     headers = {'Content-Type': "application/json"}
     res = self.client.send(data=json.dumps(datas), headers=headers)
     result = JMESPathExtractor().extract(query='success', body=res.text)
     message = JMESPathExtractor().extract(query='message', body=res.text)
     date = time.strftime('%Y-%m-%d', time.localtime(time.time()))
     responseTime = JMESPathExtractor().extract(query='responseTime',
                                                body=res.text)
     msg = '\n请求地址:' + res.url + '\n请求数据:' + json.dumps(
         datas) + '\n返回结果:' + res.text
     self.assertEqual('true', str(result).lower(), msg=msg)
     self.assertNotIn('未知', str(message), msg=msg)
     self.assertIn(date, str(responseTime), msg=msg)
Ejemplo n.º 8
0
 def test_GetMerchantList03(self):
     """验证商户名称查询"""
     mid = OpenPlatformCommon.getmid()
     mcode, mname, mshortname, mtype, mtypename, mstate, mstatename = OpenPlatformCommon.getmcode(
         mid)
     params = {'keyword': mname, 'pageIndex': 1, 'pageSize': 10}
     res = self.client.send(params=params)
     res_result = JMESPathExtractor().extract(query='success',
                                              body=res.text)
     res_datalength = JMESPathExtractor().extract(query='data.recordsTotal',
                                                  body=res.text)
     res_data = JMESPathExtractor().extract(query='data.data',
                                            body=res.text)
     msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text
     self.assertEqual('true', str(res_result).lower(), msg=msg)
     self.assertLessEqual(1, res_datalength, msg=msg)
     self.assertIn(mname, str(res_data), msg=msg)
Ejemplo n.º 9
0
 def test_PlayerLogin05(self):
     """验证手机验证码注册:有效期内多次请求验证码,输入的不是最新的"""
     mobile = 17712345678
     code1 = OpenPlatformCommon.get_smscode(mobile=mobile)
     code2 = OpenPlatformCommon.get_smscode(mobile=mobile)
     datas = {
         "channelNo": 81026962,
         "packageNo": 81026962001,
         "type": 1,
         "ip": "58.63.60.71",
         "machineCode": "s0qO3Jz9TLeM2CtQ50x",
         "appId": "8102Fv0aBOMJ5lbt6mMSrqBSPE7cpI8A",
         "terminalType": 1,
         "osVersion": "Android.8.3.1",
         "machineModel": "MI 9",
         "payload": {
             "Mobile": mobile,
             "SmsKey": "1",
             "SmsCode": code1
         },
         "networkState": 0,
         "wifiName": "MISnet"
     }
     params = json.dumps(datas)
     headers = {'Content-Type': "application/json"}
     res = self.client.send(data=params, headers=headers)
     res_success = JMESPathExtractor().extract(query='success',
                                               body=res.text)
     res_message = JMESPathExtractor().extract(query='message',
                                               body=res.text)
     res_error = JMESPathExtractor().extract(query='error', body=res.text)
     res_code = JMESPathExtractor().extract(query='code', body=res.text)
     responseTime = JMESPathExtractor().extract(query='responseTime',
                                                body=res.text)
     res_data = JMESPathExtractor().extract(query='data', body=res.text)
     msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text
     self.assertFalse(res_success, msg=msg)
     self.assertEqual('验证码错误', res_error, msg=msg)
     self.assertEqual(10, res_code, msg=msg)
     self.assertIsNone(res_data, msg=msg)
Ejemplo n.º 10
0
 def test_GetMerchantList02(self):
     """验证商户编号查询"""
     mid = OpenPlatformCommon.getmid()
     mcode, mname, mshortname, mtype, mtypename, mstate, mstatename = OpenPlatformCommon.getmcode(
         mid)
     params = {'keyword': mcode, 'pageIndex': 1, 'pageSize': 10}
     res = self.client.send(params=params)
     res_result = JMESPathExtractor().extract(query='success',
                                              body=res.text)
     res_datalength = JMESPathExtractor().extract(query='data.recordsTotal',
                                                  body=res.text)
     res_mid = JMESPathExtractor().extract(query='data.data[0].id',
                                           body=res.text)
     res_mcode = JMESPathExtractor().extract(query='data.data[0].code',
                                             body=res.text)
     res_mname = JMESPathExtractor().extract(query='data.data[0].name',
                                             body=res.text)
     res_mshortname = JMESPathExtractor().extract(
         query='data.data[0].shortName', body=res.text)
     res_mtype = JMESPathExtractor().extract(query='data.data[0].type',
                                             body=res.text)
     #返回的商户类型名称
     res_mtypename = JMESPathExtractor().extract(
         query='data.data[0].typeName', body=res.text)
     #返回的商户状态值
     res_mstate = JMESPathExtractor().extract(query='data.data[0].state',
                                              body=res.text)
     #返回的商户状态
     res_mstatename = JMESPathExtractor().extract(
         query='data.data[0].stateName', body=res.text)
     msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text
     self.assertEqual('true', str(res_result).lower(), msg=msg)
     self.assertEqual(1, res_datalength, msg=msg)
     self.assertEqual(mid, str(res_mid), msg=msg)
     self.assertEqual(mname, str(res_mname), msg=msg)
     self.assertEqual(mshortname, str(res_mshortname), msg=msg)
     self.assertEqual(mtype, res_mtype, msg=msg)
     self.assertEqual(mtypename, str(res_mtypename), msg=msg)
     self.assertEqual(mstate, res_mstate, msg=msg)
     self.assertEqual(mstatename, str(res_mstatename), msg=msg)
Ejemplo n.º 11
0
    def test_ProductList02(self):
        """验证产品列表-产品名称搜索"""
        pid = OpenPlatformCommon.getpid(self.mid, category=2, platform=1)
        params = {
            'MerchantId': self.mid,
            'Condition': 'Autotest测试',
            'PageIndex': 1,
            'PageSize': 1
        }
        res = self.client.send(params=params)
        result = JMESPathExtractor().extract(query='success', body=res.text)
        message = JMESPathExtractor().extract(query='message', body=res.text)
        date = time.strftime('%Y-%m-%d', time.localtime(time.time()))
        responseTime = JMESPathExtractor().extract(query='responseTime',
                                                   body=res.text)
        res_pid = JMESPathExtractor().extract(query='data.data[0].productId',
                                              body=res.text)
        res_pname = JMESPathExtractor().extract(
            query='data.data[0].productName', body=res.text)
        res_iconurl = JMESPathExtractor().extract(query='data.data[0].iconUrl',
                                                  body=res.text)
        res_pnum = JMESPathExtractor().extract(query='data.data[0].productNum',
                                               body=res.text)
        res_pcategory = JMESPathExtractor().extract(
            query='data.data[0].productCategory', body=res.text)
        res_psubcategory = JMESPathExtractor().extract(
            query='data.data[0].subCategory', body=res.text)
        res_pecology = JMESPathExtractor().extract(
            query='data.data[0].productEcology', body=res.text)
        res_pmname = JMESPathExtractor().extract(
            query='data.data[0].merchantName', body=res.text)
        res_department = JMESPathExtractor().extract(
            query='data.data[0].department', body=res.text)
        res_pstate = JMESPathExtractor().extract(query='data.data[0].state',
                                                 body=res.text)
        res_recordsTotal = JMESPathExtractor().extract(
            query='data.recordsTotal', body=res.text)
        msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text

        self.assertEqual('true', str(result).lower(), msg=msg)
        self.assertIn(date, str(responseTime), msg=msg)
        self.assertEqual(pid, res_pid, msg=msg)
        self.assertEqual('Autotest测试', res_pname, msg=msg)
        self.assertIn('key=Autotest', str(res_iconurl), msg=msg)
        self.assertEqual(2, res_pcategory, msg=msg)
        self.assertEqual('单网页形态', res_psubcategory, msg=msg)
        self.assertEqual(0, res_pecology, msg=msg)
        self.assertEqual('中顺网络公司', res_pmname, msg=msg)
        self.assertEqual('Web研发部门', res_department, msg=msg)
        self.assertEqual(1, res_pstate, msg=msg)
        self.assertEqual(1, res_recordsTotal, msg=msg)
Ejemplo n.º 12
0
	def test_EditMerchant02(self):
		"""验证正常编辑成功流程"""
		mid = OpenPlatformCommon.getmid()

		datas ={"id": mid, "name": "编辑网络公司", "shortName": "ZS", "state": 1, "principal": "", "creditCode": "", "legalRepresentative": "", "mobile": "", "address": "", "contactName": "张小金", "contactMobile": 19978953221, "email": "", "qq":"", "weChat": "weixin", "businessLicense": "", "classicalChinese": "", "icp": "", "corporateIdentityCard": ""}
		headers={'Content-Type': "application/json"}
		res = self.client.send(data=json.dumps(datas),headers=headers)
		result = JMESPathExtractor().extract(query='success', body=res.text)
		date = time.strftime('%Y-%m-%d',time.localtime(time.time()))
		responseTime = JMESPathExtractor().extract(query='responseTime', body=res.text)
		re_mid = JMESPathExtractor().extract(query='data', body=res.text)
		msg = '\n请求地址:'+ res.url + '\n请求数据:' + json.dumps(datas) + '\n返回结果:' + res.text
		self.assertEqual('true', str(result).lower(), msg=msg)
		self.assertNotIn('未知错误', str(res.text), msg=msg)
		self.assertEqual(mid, re_mid, msg=msg)
		self.assertIn(date, str(responseTime), msg=msg)
Ejemplo n.º 13
0
 def test_PlayerPromote05(self):
     """验证手机验证码转正:有效期内多次请求验证码,输入的不是最新的"""
     if OpenPlatformCommon.get_registinfo() != '注册失败':
         openId = OpenPlatformCommon.get_registinfo()['openId']
         unionId = OpenPlatformCommon.get_registinfo()['unionId']
         nickname = OpenPlatformCommon.get_registinfo()['nickname']
         account = OpenPlatformCommon.get_registinfo()['account']
         password = OpenPlatformCommon.get_registinfo()['password']
         mobile = 19925757299
         code1 = OpenPlatformCommon.get_smscode(mobile=mobile)
         code2 = OpenPlatformCommon.get_smscode(mobile=mobile)
         datas = {
             "openId": openId,
             "packageNo": 81036962002,
             "type": 1,
             "payload": {
                 "mobile": mobile,
                 "smsKey": "1",
                 "smsCode": code1,
                 "password": "******"
             }
         }
         params = json.dumps(datas)
         headers = {'Content-Type': "application/json"}
         res = self.client.send(data=params, headers=headers)
         res_success = JMESPathExtractor().extract(query='success',
                                                   body=res.text)
         res_message = JMESPathExtractor().extract(query='message',
                                                   body=res.text)
         res_error = JMESPathExtractor().extract(query='error',
                                                 body=res.text)
         res_code = JMESPathExtractor().extract(query='code', body=res.text)
         responseTime = JMESPathExtractor().extract(query='responseTime',
                                                    body=res.text)
         msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text
         self.assertFalse(res_success, msg=msg)
         self.assertEqual('验证短信失败', res_error, msg=msg)
         self.assertEqual(10, res_code, msg=msg)
Ejemplo n.º 14
0
    def test_ProductChannelList01(self):
        """简单验证添加产品渠道接口容错"""
        datas = ExcelReader(self.excel, sheet='ProductChannelList').data
        for d in range(0, len(datas)):
            if datas[d]['is_execute'] == 'N':
                continue
            else:
                with self.subTest(data=datas[d]['CaseNo'] +
                                  datas[d]['describe']):
                    self.setUp()
                    # logger.debug(datas[d])
                    expect = datas[d]['expect_code']
                    casename = str(datas[d]['describe'])
                    caseNo = str(datas[d]['CaseNo'])
                    #请求的参数剔除期望值列、是否执行列、描述列、用例编号列
                    datas[d].pop('expect_code')
                    datas[d].pop('is_execute')
                    datas[d].pop('describe')
                    datas[d].pop('CaseNo')
                    if datas[d]['ProductId'] == '{pid}':
                        datas[d]['ProductId'] = OpenPlatformCommon.getpid(
                            self.mid)
                    # #转换为json格式
                    # params = json.dumps(datas[d])
                    params = datas[d]
                    # headers={'Content-Type': "application/json"}
                    res = self.client.send(params=params)

                    result = JMESPathExtractor().extract(query='success',
                                                         body=res.text)
                    message = JMESPathExtractor().extract(query='message',
                                                          body=res.text)
                    msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text
                    self.assertEqual(expect, str(result).lower(), msg=msg)
                    self.assertNotIn('未知错误', str(message), msg=msg)
                    self.tearDown()
Ejemplo n.º 15
0
    def test_ProductGet02(self):
        """验证新增产品成功后获取产品信息是否正确"""
        pid = OpenPlatformCommon.getpid(self.mid)
        params = {"ProductId": pid}
        res = self.client.send(params=params)
        msg = '\n请求地址:' + res.url + '\n请求数据:' + str(pid) + '\n返回结果:' + res.text
        #获取返回信息
        result = JMESPathExtractor().extract(query='success', body=res.text)
        message = JMESPathExtractor().extract(query='message', body=res.text)
        date = time.strftime('%Y-%m-%d', time.localtime(time.time()))
        responseTime = JMESPathExtractor().extract(query='responseTime',
                                                   body=res.text)
        res_pid = JMESPathExtractor().extract(query='data.productId',
                                              body=res.text)
        res_pname = JMESPathExtractor().extract(query='data.productName',
                                                body=res.text)
        res_iconurl = JMESPathExtractor().extract(query='data.iconUrl',
                                                  body=res.text)
        res_pnum = JMESPathExtractor().extract(query='data.productNum',
                                               body=res.text)
        res_pcategory = JMESPathExtractor().extract(
            query='data.productCategory', body=res.text)
        res_pecology = JMESPathExtractor().extract(query='data.productEcology',
                                                   body=res.text)
        res_pmname = JMESPathExtractor().extract(query='data.merchantName',
                                                 body=res.text)
        res_department = JMESPathExtractor().extract(query='data.department',
                                                     body=res.text)
        res_psecret = JMESPathExtractor().extract(query='data.productSecret',
                                                  body=res.text)
        res_pintroduction = JMESPathExtractor().extract(
            query='data.introduction', body=res.text)
        res_pstate = JMESPathExtractor().extract(query='data.state',
                                                 body=res.text)
        res_psettings_platform = JMESPathExtractor().extract(
            query='data.settings.platform', body=res.text)
        res_psettings_packagename = JMESPathExtractor().extract(
            query='data.settings.packageName', body=res.text)
        res_psettings_signature = JMESPathExtractor().extract(
            query='data.settings.signature', body=res.text)
        res_psettings_bundleID = JMESPathExtractor().extract(
            query='data.settings.bundleID', body=res.text)
        res_psettings_appID = JMESPathExtractor().extract(
            query='data.settings.appId', body=res.text)
        res_psettings_h5type = JMESPathExtractor().extract(
            query='data.settings.h5Type', body=res.text)
        res_psettings_h5platformname = JMESPathExtractor().extract(
            query='data.settings.h5PlatformName', body=res.text)
        res_psettings_h5address = JMESPathExtractor().extract(
            query='data.settings.h5Address', body=res.text)
        res_psettings_smallProgramId = JMESPathExtractor().extract(
            query='data.settings.smallProgramId', body=res.text)
        res_psettings_smallPlatformType = JMESPathExtractor().extract(
            query='data.settings.smallPlatformType', body=res.text)

        self.assertEqual('true', str(result).lower(), msg=msg)
        self.assertIn(date, str(responseTime), msg=msg)
        self.assertEqual(pid, res_pid, msg=msg)
        self.assertEqual('Autotest测试', res_pname, msg=msg)
        self.assertIn('key=Autotest', str(res_iconurl), msg=msg)
        self.assertEqual(1, res_pcategory, msg=msg)
        self.assertEqual(0, res_pecology, msg=msg)
        self.assertEqual('中顺网络公司', res_pmname, msg=msg)
        self.assertEqual('Web研发部门', res_department, msg=msg)
        self.assertEqual('Autotest自动化自动创建产品', res_pintroduction, msg=msg)
        self.assertEqual(1, res_pstate, msg=msg)
        self.assertEqual(0, res_psettings_platform, msg=msg)
        self.assertEqual('Autotest', res_psettings_packagename, msg=msg)
        self.assertEqual('Autotest', res_psettings_signature, msg=msg)
        self.assertEqual('Autotest.bundleID', res_psettings_bundleID, msg=msg)
        self.assertEqual('Autotest.appId', res_psettings_appID, msg=msg)
        self.assertEqual(0, res_psettings_h5type, msg=msg)
        self.assertEqual('AutotestH5', res_psettings_h5platformname, msg=msg)
        self.assertEqual('Autotest.H5', res_psettings_h5address, msg=msg)
        self.assertEqual('AutotestsmallProgramId',
                         res_psettings_smallProgramId,
                         msg=msg)
        self.assertEqual(0, res_psettings_smallPlatformType, msg=msg)
Ejemplo n.º 16
0
 def setUp(self):
     self.client = HTTPClient(url=self.API_URL, method='GET')
     self.mid = OpenPlatformCommon.getmid()
     logger.info('开始测试')
Ejemplo n.º 17
0
    def test_ProductGet03(self):
        """验证修改产品成功后获取产品信息是否正确"""
        pid = OpenPlatformCommon.getpid(self.mid)
        edit_datas = {
            "productId": pid,
            "name": "编辑产品名Autotest",
            "iconUrl": "iconUrl.modify",
            "department": "modify部门",
            "introduction": "modify介绍",
            "state": 2,
            "settings": {
                "packageName": "modify包名",
                "signature": "modifysignature",
                "bundleID": "modifybundleID",
                "appId": "modifyAPPID",
                "h5PlatformName": "modifyH5平台名",
                "h5Address": "modifyH5.Address",
                "smallProgramId": "modifysmallProgramId"
            }
        }
        edit_url = Config().get('OpenPlatform_API').get('Product').get(
            'Product')
        edit_headers = {'Content-Type': "application/json"}
        edit_client = HTTPClient(url=self.API_URL, method='PATCH')
        edit_client.send(data=json.dumps(edit_datas), headers=edit_headers)
        #查询编辑后的产品信息
        params = {"ProductId": pid}
        res = self.client.send(params=params)
        msg = '\n请求地址:' + res.url + '\n请求数据:' + str(pid) + '\n返回结果:' + res.text
        #获取返回信息
        result = JMESPathExtractor().extract(query='success', body=res.text)
        message = JMESPathExtractor().extract(query='message', body=res.text)
        date = time.strftime('%Y-%m-%d', time.localtime(time.time()))
        responseTime = JMESPathExtractor().extract(query='responseTime',
                                                   body=res.text)
        res_pid = JMESPathExtractor().extract(query='data.productId',
                                              body=res.text)
        res_pname = JMESPathExtractor().extract(query='data.productName',
                                                body=res.text)
        res_iconurl = JMESPathExtractor().extract(query='data.iconUrl',
                                                  body=res.text)
        res_pnum = JMESPathExtractor().extract(query='data.productNum',
                                               body=res.text)
        res_pcategory = JMESPathExtractor().extract(
            query='data.productCategory', body=res.text)
        res_pecology = JMESPathExtractor().extract(query='data.productEcology',
                                                   body=res.text)
        res_pmname = JMESPathExtractor().extract(query='data.merchantName',
                                                 body=res.text)
        res_department = JMESPathExtractor().extract(query='data.department',
                                                     body=res.text)
        res_psecret = JMESPathExtractor().extract(query='data.productSecret',
                                                  body=res.text)
        res_pintroduction = JMESPathExtractor().extract(
            query='data.introduction', body=res.text)
        res_pstate = JMESPathExtractor().extract(query='data.state',
                                                 body=res.text)
        res_psettings_platform = JMESPathExtractor().extract(
            query='data.settings.platform', body=res.text)
        res_psettings_packagename = JMESPathExtractor().extract(
            query='data.settings.packageName', body=res.text)
        res_psettings_signature = JMESPathExtractor().extract(
            query='data.settings.signature', body=res.text)
        res_psettings_bundleID = JMESPathExtractor().extract(
            query='data.settings.bundleID', body=res.text)
        res_psettings_appID = JMESPathExtractor().extract(
            query='data.settings.appId', body=res.text)
        res_psettings_h5type = JMESPathExtractor().extract(
            query='data.settings.h5Type', body=res.text)
        res_psettings_h5platformname = JMESPathExtractor().extract(
            query='data.settings.h5PlatformName', body=res.text)
        res_psettings_h5address = JMESPathExtractor().extract(
            query='data.settings.h5Address', body=res.text)
        res_psettings_smallProgramId = JMESPathExtractor().extract(
            query='data.settings.smallProgramId', body=res.text)
        res_psettings_smallPlatformType = JMESPathExtractor().extract(
            query='data.settings.smallPlatformType', body=res.text)

        self.assertEqual('true', str(result).lower(), msg=msg)
        self.assertIn(date, str(responseTime), msg=msg)
        self.assertEqual(pid, res_pid, msg=msg)
        self.assertEqual('编辑产品名Autotest', res_pname, msg=msg)
        self.assertIn('key=iconUrl.modify', str(res_iconurl), msg=msg)
        self.assertEqual(1, res_pcategory, msg=msg)
        self.assertEqual(0, res_pecology, msg=msg)
        self.assertEqual('中顺网络公司', res_pmname, msg=msg)
        self.assertEqual('modify部门', res_department, msg=msg)
        self.assertEqual('modify介绍', res_pintroduction, msg=msg)
        self.assertEqual(2, res_pstate, msg=msg)
        self.assertEqual(0, res_psettings_platform, msg=msg)
        self.assertEqual('modify包名', res_psettings_packagename, msg=msg)
        self.assertEqual('modifysignature', res_psettings_signature, msg=msg)
        self.assertEqual('modifybundleID', res_psettings_bundleID, msg=msg)
        self.assertEqual('modifyAPPID', res_psettings_appID, msg=msg)
        self.assertEqual(0, res_psettings_h5type, msg=msg)
        self.assertEqual('modifyH5平台名', res_psettings_h5platformname, msg=msg)
        self.assertEqual('modifyH5.Address', res_psettings_h5address, msg=msg)
        self.assertEqual('modifysmallProgramId',
                         res_psettings_smallProgramId,
                         msg=msg)
        self.assertEqual(0, res_psettings_smallPlatformType, msg=msg)
Ejemplo n.º 18
0
 def test_GetMerchant03(self):
     """验证编辑成功后查询接口返回信息是否正确"""
     mid = OpenPlatformCommon.getmid()
     #编辑商户信息
     edit_datas = {
         "id":
         mid,
         "name":
         "编辑网络公司",
         "shortName":
         "ZS",
         "state":
         2,
         "principal":
         "",
         "creditCode":
         "",
         "legalRepresentative":
         "",
         "mobile":
         "19978953221",
         "address":
         "",
         "contactName":
         "张小金",
         "contactMobile":
         13778953221,
         "email":
         "*****@*****.**",
         "qq":
         123456,
         "weChat":
         "weixin",
         "businessLicense":
         "20190723/953ba822fb8643b282e6102712d00024.jpg",
         "classicalChinese":
         "20190723/c5e60fd2961b97aca2ea3ec735891111.jpg",
         "icp":
         "20190723/056fa26e44814b1ea36b288df9522222.jpeg",
         "corporateIdentityCard":
         "20190723/9fc2f9a61ae8486084f69ea6393f3333.jpeg"
     }
     edit_headers = {'Content-Type': "application/json"}
     edit_url = Config().get('OpenPlatform_API').get('Merchant').get(
         'MerchantEdit')
     edit_client = HTTPClient(url=edit_url, method='POST')
     edit_client.send(data=json.dumps(edit_datas), headers=edit_headers)
     #查询商户信息
     params = {"id": mid}
     res = self.client.send(params=params)
     #返回的success值
     result = JMESPathExtractor().extract(query='success', body=res.text)
     #返回的商户id
     res_id = JMESPathExtractor().extract(query='data.id', body=res.text)
     #返回的商户名称
     res_name = JMESPathExtractor().extract(query='data.name',
                                            body=res.text)
     #返回的商户简称
     res_shortname = JMESPathExtractor().extract(query='data.shortName',
                                                 body=res.text)
     #返回的商户类型
     res_type = JMESPathExtractor().extract(query='data.type',
                                            body=res.text)
     #返回的商户类型名称
     res_typename = JMESPathExtractor().extract(query='data.typeName',
                                                body=res.text)
     #返回的商户状态值
     res_state = JMESPathExtractor().extract(query='data.state',
                                             body=res.text)
     #返回的商户状态
     res_statename = JMESPathExtractor().extract(query='data.stateName',
                                                 body=res.text)
     #返回的商户主体
     res_principal = JMESPathExtractor().extract(query='data.principal',
                                                 body=res.text)
     #返回的社会统一信用码
     res_creditcode = JMESPathExtractor().extract(query='data.creditCode',
                                                  body=res.text)
     #返回的法人信息
     res_legalrepresentative = JMESPathExtractor().extract(
         query='data.legalRepresentative', body=res.text)
     #返回的联系电话
     res_mobile = JMESPathExtractor().extract(query='data.mobile',
                                              body=res.text)
     #返回的地址
     res_address = JMESPathExtractor().extract(query='data.address',
                                               body=res.text)
     #返回的联系人名称
     res_contactname = JMESPathExtractor().extract(query='data.contactName',
                                                   body=res.text)
     #返回的联系人手机
     res_contactmobile = JMESPathExtractor().extract(
         query='data.contactMobile', body=res.text)
     #返回的联系人邮箱地址
     res_email = JMESPathExtractor().extract(query='data.email',
                                             body=res.text)
     #返回的联系人QQ号码
     res_qq = JMESPathExtractor().extract(query='data.qq', body=res.text)
     #返回的联系人微信号
     res_wechat = JMESPathExtractor().extract(query='data.weChat',
                                              body=res.text)
     #返回的营业执照
     res_businesslicense = JMESPathExtractor().extract(
         query='data.businessLicense', body=res.text)
     #返回的文网文
     res_classicalchinese = JMESPathExtractor().extract(
         query='data.classicalChinese', body=res.text)
     #返回的ICP
     res_icp = JMESPathExtractor().extract(query='data.icp', body=res.text)
     #返回的法人身份证
     res_corporateidentitycard = JMESPathExtractor().extract(
         query='data.corporateIdentityCard', body=res.text)
     msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text
     self.assertEqual('true', str(result).lower(), msg=msg)
     self.assertEqual(mid, str(res_id), msg=msg)
     self.assertEqual('编辑网络公司', str(res_name), msg=msg)
     self.assertEqual('ZS', str(res_shortname), msg=msg)
     self.assertEqual('1', str(res_type), msg=msg)
     self.assertEqual('自研', str(res_typename), msg=msg)
     self.assertEqual('2', str(res_state), msg=msg)
     self.assertEqual('禁用', str(res_statename), msg=msg)
     self.assertEqual('', str(res_principal), msg=msg)
     self.assertEqual('', str(res_creditcode), msg=msg)
     self.assertEqual('', str(res_legalrepresentative), msg=msg)
     self.assertEqual('19978953221', str(res_mobile), msg=msg)
     self.assertEqual('', str(res_address), msg=msg)
     self.assertEqual('张小金', str(res_contactname), msg=msg)
     self.assertEqual('13778953221', str(res_contactmobile), msg=msg)
     self.assertEqual('*****@*****.**', str(res_email), msg=msg)
     self.assertEqual('123456', str(res_qq), msg=msg)
     self.assertEqual('weixin', str(res_wechat), msg=msg)
     self.assertIn('20190723/953ba822fb8643b282e6102712d00024.jpg',
                   str(res_businesslicense),
                   msg=msg)
     self.assertIn('20190723/c5e60fd2961b97aca2ea3ec735891111.jpg',
                   str(res_classicalchinese),
                   msg=msg)
     self.assertIn('20190723/056fa26e44814b1ea36b288df9522222.jpeg',
                   str(res_icp),
                   msg=msg)
     self.assertIn('20190723/9fc2f9a61ae8486084f69ea6393f3333.jpeg',
                   str(res_corporateidentitycard),
                   msg=msg)
Ejemplo n.º 19
0
    def test_GetMerchant02(self):
        """验证创建成功后查询接口返回信息是否正确"""
        mid = OpenPlatformCommon.getmid()
        params = {"id": mid}
        res = self.client.send(params=params)
        #返回的success值
        result = JMESPathExtractor().extract(query='success', body=res.text)
        #返回的商户id
        res_id = JMESPathExtractor().extract(query='data.id', body=res.text)
        #返回的商户名称
        res_name = JMESPathExtractor().extract(query='data.name',
                                               body=res.text)
        #返回的商户简称
        res_shortname = JMESPathExtractor().extract(query='data.shortName',
                                                    body=res.text)
        #返回的商户类型
        res_type = JMESPathExtractor().extract(query='data.type',
                                               body=res.text)
        #返回的商户类型名称
        res_typename = JMESPathExtractor().extract(query='data.typeName',
                                                   body=res.text)
        #返回的商户状态值
        res_state = JMESPathExtractor().extract(query='data.state',
                                                body=res.text)
        #返回的商户状态
        res_statename = JMESPathExtractor().extract(query='data.stateName',
                                                    body=res.text)
        #返回的商户主体
        res_principal = JMESPathExtractor().extract(query='data.principal',
                                                    body=res.text)
        #返回的社会统一信用码
        res_creditcode = JMESPathExtractor().extract(query='data.creditCode',
                                                     body=res.text)
        #返回的法人信息
        res_legalrepresentative = JMESPathExtractor().extract(
            query='data.legalRepresentative', body=res.text)
        #返回的联系电话
        res_mobile = JMESPathExtractor().extract(query='data.mobile',
                                                 body=res.text)
        #返回的地址
        res_address = JMESPathExtractor().extract(query='data.address',
                                                  body=res.text)
        #返回的联系人名称
        res_contactname = JMESPathExtractor().extract(query='data.contactName',
                                                      body=res.text)
        #返回的联系人手机
        res_contactmobile = JMESPathExtractor().extract(
            query='data.contactMobile', body=res.text)
        #返回的联系人邮箱地址
        res_email = JMESPathExtractor().extract(query='data.email',
                                                body=res.text)
        #返回的联系人QQ号码
        res_qq = JMESPathExtractor().extract(query='data.qq', body=res.text)
        #返回的联系人微信号
        res_wechat = JMESPathExtractor().extract(query='data.weChat',
                                                 body=res.text)
        #返回的营业执照
        res_businesslicense = JMESPathExtractor().extract(
            query='data.businessLicense', body=res.text)
        #返回的文网文
        res_classicalchinese = JMESPathExtractor().extract(
            query='data.classicalChinese', body=res.text)
        #返回的ICP
        res_icp = JMESPathExtractor().extract(query='data.icp', body=res.text)
        #返回的法人身份证
        res_corporateidentitycard = JMESPathExtractor().extract(
            query='data.corporateIdentityCard', body=res.text)

        msg = '\n请求地址:' + res.url + '\n返回结果:' + res.text

        self.assertEqual('true', str(result).lower(), msg=msg)
        self.assertEqual(mid, str(res_id), msg=msg)
        self.assertEqual('中顺网络公司', str(res_name), msg=msg)
        self.assertEqual('ZS棋牌', str(res_shortname), msg=msg)
        self.assertEqual('1', str(res_type), msg=msg)
        self.assertEqual('自研', str(res_typename), msg=msg)
        self.assertEqual('1', str(res_state), msg=msg)
        self.assertEqual('正常', str(res_statename), msg=msg)
        self.assertEqual('中顺棋牌', str(res_principal), msg=msg)
        self.assertEqual('91440106589536704F', str(res_creditcode), msg=msg)
        self.assertEqual('李石头', str(res_legalrepresentative), msg=msg)
        self.assertEqual('39956888', str(res_mobile), msg=msg)
        self.assertEqual('广东省广州市天河区天河软件园建中路50号多玩游戏大厦4楼',
                         str(res_address),
                         msg=msg)
        self.assertEqual('王小姐', str(res_contactname), msg=msg)
        self.assertEqual('19978953221', str(res_contactmobile), msg=msg)
        self.assertEqual('*****@*****.**', str(res_email), msg=msg)
        self.assertEqual('54321', str(res_qq), msg=msg)
        self.assertEqual('qkagame', str(res_wechat), msg=msg)
        self.assertIn('20190722/953ba822fb8643b282e6102712d96c24.jpg',
                      str(res_businesslicense),
                      msg=msg)
        self.assertIn('20190722/c5e60fd2961b97aca2ea3ec735892a40.jpg',
                      str(res_classicalchinese),
                      msg=msg)
        self.assertIn('20190722/056fa26e44814b1ea36b288df9523f2f.jpeg',
                      str(res_icp),
                      msg=msg)
        self.assertIn('20190722/9fc2f9a61ae8486084f69ea6393f637d.jpeg',
                      str(res_corporateidentitycard),
                      msg=msg)