Commit 21bcd882 by zhaihuitao

add payment enevt

parent 153ffcb9
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.4 (/anaconda3/bin/python3.6)" project-jdk-type="Python SDK" />
<component name="SvnConfiguration">
<configuration />
</component>
</project>
\ No newline at end of file
......@@ -21,4 +21,7 @@ class randomUtil:
i = ''.join(str(random.choice(range(10))) for _ in range(12))
return i
def transactionid(self):
t = ''.join(str(random.choice(range(10))) for _ in range(19))
return t
r = randomUtil()
\ No newline at end of file
......@@ -7,6 +7,7 @@
"""
import time
import random
from config.envcfg import prod
from common import randomUtil
......@@ -190,4 +191,29 @@ params_register = {
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
}
\ No newline at end of file
}
params_pay = {
'what': 'payment',
'appid': prod['events']['appkey'],
'context': {
'_deviceid': randomUtil.r.randimei(),
'_imei': randomUtil.r.randimei(),
'_androidid': randomUtil.r.randimei(),
'_ip': randomUtil.r.randip(),
'_timestamp': int(round(time.time() * 1000)),
'_transactionid': randomUtil.r.transactionid(),
'_paymenttype': "alipay",
'_ryos': "android",
'_currencytype': "CNY",
'_currencyamount': "10",
"_lib_version": "1.5.0",
'_oaid': "unknow",
# "_idfa": "00000000-0000-0000-0000-000000000000",
# "_idfv": ""
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
}
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: test_pay.py
@time: 2020/8/20 15:43
@desc:
"""
import unittest
import json
import requests
from config.envcfg import prod, headers
from config.prod.params import params_pay
class payTestCase(unittest.TestCase):
def testpayment(self):
r = requests.post(url=prod['events']['url'] + 'payment', data=json.dumps(params_pay), headers=headers, timeout=5)
print("付费" + r.text)
print(prod['events']['url'] + 'payment')
print(json.dumps(params_pay))
print(r)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment