def testRefreshToken(self): # 获取refresh_token content = configHttp.access_token() if self.refresh_token == '': self.refresh_token = content['data']['refresh_token'] print(self.refresh_token) self.url = common.get_url_from_xml('refresh_access_token') # set url url = configHttp.set_url(self.url) print(url) # set params data = {'app_id': self.app_id, 'refresh_token': self.refresh_token} configHttp.set_data(data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testAccessToken(self): ''' 使用code获取token :return: ''' # set code code = configHttp.code() self.url = common.get_url_from_xml('access_token') # set url url = configHttp.set_url(self.url) print(url) # set data data = {'app_id': self.app_id, 'secret': self.secret, 'code': code} configHttp.set_data(data) print(data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testCreateOrder(self): self.url = common.get_url_from_xml('create_order') # set url url = configHttp.set_url(self.url) print(url) # set headers # headers = configHttp.set_headers(self.headers) # print(headers) # set data self.data['merchant_order_sn'] = str(uuid.uuid1()) sign = configSign.getSignature(self.data, self.appsecret) self.data['sign'] = sign configHttp.set_data(self.data) print(self.data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testSearchOrder(self): # set url self.url = common.get_url_from_xml('search_order') url = configHttp.set_url(self.url) # set params configHttp.set_data(self.data) print(self.data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testInfo_chain(self): # set url self.url = common.get_url_from_xml('info_chain') url = configHttp.set_url(self.url) # set headers configHttp.set_headers(self.headers) print(self.headers) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testTxRawtx(self): self.url = common.get_url_from_xml('tx_Rawtx') # set url url = configHttp.set_url(self.url) print(url) # set headers headers = configHttp.set_headers(self.headers) print(headers) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testCount(self): self.url = common.get_url_from_xml('count') # set url url = configHttp.set_url(self.url) print(url) # set headers self.header['token'] = configHttp.get_openapi_token() configHttp.set_headers(self.header) print(self.header) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testMerkle(self): # set url self.url = common.get_url_from_xml('merkle') url = configHttp.set_url(self.url) print(url) # set headers configHttp.set_headers(self.headers) print(self.headers) # set params configHttp.set_data(self.data) print(self.data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testPaySmallMoney(self): ''' 发起小额支付 :return: ''' self.url = common.get_url_from_xml('pay_small_money') # set url url = configHttp.set_url(self.url) configHttp.set_data(self.data) print(self.data) print(type(self.data)) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url,self.return_json,self.code)
def testGetHostedAccount(self): self.url = common.get_url_from_xml('get_hosted_account_balance') # set url url = configHttp.set_url(self.url) print(url) # set headers configHttp.set_headers(self.headers) # set data configHttp.set_data(self.data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)
def testPushChainDataDotWallet(self): self.url = common.get_url_from_xml('push_chain_data_dotwallet') # set url configHttp.set_url(self.url) # set data data = { 'coin_type': self.coin_type, 'email': self.email, 'data': self.data, 'data_type': self.data_type, 'sign_callback': self.sign_callback } configHttp.set_data(data) # test interface try: self.return_json = configHttp.requests_by_method(self.method) except Exception as Ex: self.logger.exception(Ex) return common.checkResult(url, self.return_json, self.code)