Exemple #1
0
 def test_003_GBBO下单(self):
     trade_token = api_funcs.get_trade_token(gbbo_data.gbbo_token)
     account_token = api_funcs.get_account_token(gbbo_data.gbbo_token)
     token = api_funcs.get_order_token(account_token)
     session = api_funcs.get_session(token, trade_token)
     res = api_funcs.gbbo_create_order(session, gbbo_data.gbbo_account_id)
     self.assertIn('', res.json())
Exemple #2
0
    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())
Exemple #3
0
    def test_001_创建账户token(self):
        url = self.host + '/otc/account/createToken'
        headers = {'Content-Type': 'application/json', 'cache-control': 'cache-control', 'ssoToken': self.token}
        res = requests.post(url, headers=headers)
        print(res.json())
        self.otc_token = res.json()['token']
        print(self.otc_token)

        self.assertEqual({'expiredSeconds': 60}, res.json(), '返回的用户信息不正确')
        API_functions.print_logfile(self.__dict__['_testMethodName'], res.url, res.json())
Exemple #4
0
    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)
Exemple #5
0
    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())
Exemple #6
0
    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())
Exemple #7
0
    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())
Exemple #8
0
    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())
Exemple #9
0
    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())
Exemple #10
0
    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())
Exemple #11
0
 def test_021_实名认证证件可用性(self):
     url = self.host + '/api/sso/new-identify/card-effective/xx'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.get(url, headers=headers)
     print(res.json())
     self.assertEqual({'result': True}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #12
0
 def test_015_查询收藏交易对(self):
     url = self.host + '/api/sso/favorites-pair/query-all'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.get(url, headers=headers)
     self.assertEqual(user_data.query_favorites_pari_res, res.json(),
                      '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #13
0
 def test_022_查询是否开启交易密码(self):
     url = self.host + '/api/sso/new-user/query-open-trade-password'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.get(url, headers=headers)
     print(res.json())
     self.assertEqual({'result': False}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #14
0
    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())
Exemple #15
0
 def test_027_实名认证表单查询(self):
     url = self.host + '/api/sso/form/identify/query'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.get(url, headers=headers)
     print(res.json())
     self.assertEqual(user_data.kyc_query_info, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #16
0
 def ftest_004_用户登录(self):
     url = self.host + "/api/sso/user/login"
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control'
     }
     data = '{"phone":"15811055254","password":"******","codeType":"PHONE","userClientInfo":{"deviceModel":"谷歌","deviceId":"75.0.3770.100","resolution":1680,"os":"web"},"captchaValidateStr":"03AOLTBLSnHgchSEyLGzj-TuWJRK9ebLCgvTxwQsQrcP7BftsAdkWwq3tJEAy0XYnrt4uF42PWxf1x_21Flc0wfAD1ZvhKEwbdYYls3zy8oapSDY_gp8sxhibrP3zBYddm_aD8kTvAsAIRAxETs6TzTbKGBNNLEtRCz0oxKhLTSeEpZzZtDsJrSZbw5exemVfPhrovriKG5mHXo5JFBQPyNSwnDRn7-crwSUd-amntVUlkTdAKzMd02he13hNMkt0r-rLeF4OlOC8SuqCqAM8fmdPNK08LosYdTbMLBK1z26MAZd75ARd3xyS6eCO4KEUzHLX5Dh4d1RXKSEqkoK-eSQ9Q6Feos1N_BQ","captchaValidateType":"google","geeCode":"79ac33a285625b054b1b5d8652e23a75"}'
     res = requests.post(url, headers=headers, data=data.encode('utf-8'))
     print(res.json())
     self.assertEqual({'expiredSeconds': 60}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #17
0
 def test_006_获取当前用户安全设置信息(self):
     url = self.host + "/api/sso/user/get_security_settings_info"
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.post(url, headers=headers)
     print(res.json())
     self.assertEqual(user_data.user_info, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #18
0
 def test_014查询实名状态(self):
     url = self.host + '/api/sso/user/identify.query'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.get(url, headers=headers)
     print(res.json())
     self.assertEqual(user_data.identify_status_res, res.json(),
                      '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #19
0
 def test_025_实名认证表单修改(self):
     url = self.host + '/api/sso/form/identify/update'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     data = '{"first_name": "1", "last_name": "2", "age": "3", "photoPath": "4", "size": "tes"}'
     res = requests.post(url, headers=headers, data=data)
     print(res.json())
     self.assertEqual({'result': True}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #20
0
 def ftest_031_谷歌验证码解绑(self):
     url = self.host + '/api/sso/security/unbindingSecretKey'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     data = '{"password":"******","googleCode":"058444"}'
     res = requests.post(url, headers=headers, data=data)
     print(res.json())
     self.assertEqual({'result': True}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #21
0
 def test_008_校验用户是否存在(self):
     url = self.host + "/api/sso/user/user_verify"
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control'
     }
     res = requests.post(url,
                         headers=headers,
                         data=str(user_data.account).replace("'", '"'))
     print(res.json())
     self.assertEqual(user_data.expect_verifY_res, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #22
0
 def test_026_实名认证表单提交(self):
     url = self.host + '/api/sso/form/identify/submit'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     data = '{"idNumber":"130133199108081555","expireDate":"08-29-2019","country":"CN","idType":"idCard","nameFront":"祁同伟","genderFront":"男","NationalityFront":"汉","birthdayFront":"19760206","addressFront":"东省京州市温泉县南坊镇祁家村四组","idnumberFront":"","frontPathFront":"sso/identification/20190801/e33372f4bbc54ae9bc83fcafa44ebb08.jpg","expireTimeBack":"20080812","backPathBack":"sso/identification/20190801/5730794684b14ca5b913646933be224c.jpg","dateIssuanceBack":"19980812","organizationBack":"京州市公安局","selfPathSelf":"sso/identification/20190801/4a0974ecc44e43eb96977ed85efac3e9.jpg","firstName":"同伟","lastName":"祁","gender":"男","birthday":"02-06-1976","street":"东省京州市温泉县南坊镇祁家村四组","city":"3222","address":"home","addressPath":"sso/identification/20190801/e33372f4bbc54ae9bc83fcafa44ebb08.jpg","deviceCode":null}'
     res = requests.post(url, headers=headers, data=data.encode('utf-8'))
     print(res.json())
     self.assertEqual({'result': True}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #23
0
 def ftest_029_谷歌验证码绑定(self):
     url = self.host + '/api/sso/security/bindingSecretKey'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     data = '{"password": "******", "googleCode": "580328", "secretKey": "7BM7SNK4VJMZEXP2"}'
     res = requests.post(url, headers=headers, data=data)
     print(res.json())
     self.assertEqual(user_data.kyc_query_info, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #24
0
 def ftest_007_查询用户登录记录(self):
     url = self.host + "/api/sso/user/get_login_historys"
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     data = '{"pageNum": 1, "pageSize": 5}'
     res = requests.post(url, headers=headers, data=data)
     print(res.json())
     self.assertEqual(user_data.user_info, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #25
0
 def test_009_查询用户登录历史(self):
     url = self.host + "/api/sso/log/login"
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.post(url, headers=headers)
     print(res.json())
     for i in res.json():
         print(i)
     # self.assertEqual(user_data.expect_verifY_res, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #26
0
 def ftest_012_修改登录密码前验证(self):
     url = self.host + '/api/sso/user/password_verify'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     data = '{"password": "******", "googleCode": "123456"}'
     # {"operateType":"BIND_EMAIL","codeType":"EMAIL","email":"*****@*****.**","emailCode":"501696","googleCode":""}
     res = requests.post(url, headers=headers, data=data)
     print(res.json())
     self.assertEqual({"result": True}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #27
0
 def test_017_删除收藏交易对(self):
     url = self.host + '/api/sso/favorites-pair/delete'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     res = requests.post(url,
                         headers=headers,
                         data=str(user_data.del_favorites_pari).replace(
                             "'", '"'))
     print(res.json())
     self.assertEqual({'result': 1}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #28
0
 def ftest_018_发送API申请(self):
     url = self.host + '/api/sso/user/sso.send'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control',
         'token': self.token
     }
     d = {"codeType": "PHONE", "operateType": "API_APPLY"}
     res = requests.post(url,
                         headers=headers,
                         data=str(d).replace("'", '"'))
     print(res.json())
     self.assertEqual({'expiredSeconds': 60}, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #29
0
 def test_020_根据邀请码查询用户名称(self):
     url = self.host + '/api/sso/invite/getUserName'
     headers = {
         'Content-Type': 'application/json',
         'cache-control': 'cache-control'
     }
     d = {"inviteCode": "LLDQX"}
     res = requests.get(url, headers=headers, params=d)
     print(res.json())
     self.assertEqual({
         'userName': '******',
         'userCode': 'LLDQX'
     }, res.json(), '返回的用户信息不正确')
     API_functions.print_logfile(self.__dict__['_testMethodName'], res.url,
                                 res.json())
Exemple #30
0
 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())