def test_006_新增或修改支付方式(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/payType/addOrEdit' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = '{"accountId": "OTC-1102764", "type": "BANK", "fullName": "李元芳", "accountNumber":"1234", "status":"OPENED", "bankInfo":{"bankName":"招商银行", "bankBranchName":"上地支行"}, "qrCode":null}' res = requests.post(url, headers=headers, data=data.encode('utf-8')) print(res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_005_绑定币币账户(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/account/bind' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = '{"accountId": "OTC-1102661", "nickName": "ttess333"}' res = requests.post(url, headers=headers, data=data) print(res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json(), data)
def test_005_查询用户所有支付方式列表(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/payType/list' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} params = {"accountId": "OTC-1102661"} res = requests.get(url, headers=headers, params=params) print(res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_003_查询账户信息(self): otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/account/query' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} res = requests.get(url, headers=headers) print(res.json()) otc_account_info = {'accountId': 'OTC-1102661', 'spotAccountId': 'STA-01102661', 'ex55Pin': '1102661', 'nickname': '12344ff', 'status': 'OPENED', 'orderPermission': 'OPENED', 'stallPermission': 'OPENED', 'onlineStatus': 'ONLINE'} self.assertEqual(otc_account_info, res.json(), '返回的结果正确') API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_017_分页查询资产划转及买入卖出记录(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/asset/transfer/listOfPage' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = {"accountId": "OTC-1102764", "pageNum": 1,"pageSize": 10} res = requests.get(url, headers=headers, params=data) print(res.json()) self.assertEqual(['BANK'], res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_016_查询otc账户资产可用金额(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/asset/available' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = {"accountId": "OTC-1102764", "currency": "ETH"} res = requests.get(url, headers=headers, params=data) print(res.json()) self.assertEqual(['BANK'], res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_010_查询用户可用支付方式(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/payType/active.list' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = {"accountId": "OTC-1102764"} res = requests.get(url, headers=headers, params=data) print(res.json()) self.assertEqual(['BANK'], res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_008_删除支付方式(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/payType/delete' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = '{"accountId": "OTC-1102764", "type": "PAYPAL"}' res = requests.post(url, headers=headers, data=data.encode('utf-8')) print(res.json()) # self.assertEqual() API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def ftest_014_查询文件临时地址(self): # get otc token otc_token = API_functions.get_otc_token(self.host, self.token) url = self.host + '/otc/upload/file.query' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} data = {"accountId": "OTC-1102764"} file = {'file': open('', 'rn')} res = requests.get(url, headers=headers, params=data) print(res.json()) self.assertEqual(['BANK'], res.json()) API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
def test_002_创建下单时使用的ticket(self): otc_token = API_functions.get_otc_token(self.host, self.token) # get trade token url = self.host + '/api/sso/user/trade_password_verify' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': self.token} data = '{"password":"******","tradePasswordType":"OTC_TRADE_PASSWORD"}' validToken = requests.post(url, headers=headers, data=data).json()['token'] # 下单ticket url = self.host + '/otc/account/createTicket' headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'token': otc_token} params = {"validToken": validToken, "accountId": "OTC-1102661"} res = requests.post(url, headers=headers, params=params) print(res.json()) self.assertEqual(['token', 'expiredAt'], list(res.json().keys()), '返回的结果正确') # self.assertEqual({'expiredSeconds': 60}, res.json(), '返回的用户信息不正确') API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())