Beispiel #1
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()
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #5
0
 def setUp(self):
     self.client = HTTPClient(url=self.API_URL, method='GET')
     self.mid = OpenPlatformCommon.getmid()
     logger.info('开始测试')
Beispiel #6
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)
Beispiel #7
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)