Commit 105ee656 by liuxiaoxing

Merge remote-tracking branch 'remotes/origin/recieveandroid-se' into receiveios-asa

# Conflicts: # microservices/receiveandroid.py # microservices/receiveios.py 合并asa和se代码
parents 5fa9497a f12a93a3
......@@ -36,7 +36,7 @@ ry_adcreative_name = 'c测试1'
# bytedance_int 今日头条,kuaishou_int 快手,tencentams_int (新)广点通,rryingxiao_int 人人营销
pid = 'rryingxiao_int'
# URL = 'http://52.80.137.106:8083/tkio/V3Q7bqa?noredirect=true'
URL = 'http://uri6.com/tkio/2MRFZra?noredirect=true'
URL = 'http://uri6.com/tkio/A3QzEva?noredirect=true'
# 测试头条衍生事件回调时加上
# callback= http%3A%2F%2Fad.toutiao.com%2Ftrack%2Factivate%2F%3Fcallback%3DCKP4rs-Zn4QDEKiQ6teZn4QDGN6L8Y-h9Wcg3ovxj6H1ZyiE0PjgroSEAzAOOM_X-8IDQik0YWY1NzdlOC1lZmViLTRmZDEtYmZkZC00MzE1Zjc1MmJhMGF1NTQ5M0iA0pOtA1AAiAEAkAECmAEA%26os%3D0%26muid%3D
......@@ -121,9 +121,9 @@ for index in range(1):
# 'ry_adgroup_name': ry_adgroup_name,
# 'ry_adplan_name': ry_adplan_name,
# 'ry_adcreative_name': ry_adcreative_name,
"ry_adgroup_id": ry_adgroup_id,
"ry_adplan_id": ry_adplan_id,
"ry_adcreative_id": ry_adcreative_id,
# "ry_adgroup_id": ry_adgroup_id,
# "ry_adplan_id": ry_adplan_id,
# "ry_adcreative_id": ry_adcreative_id,
# 'imei2': 'null',
# 'meid': i
# 'bd_vid': i
......@@ -186,14 +186,14 @@ for index in range(1):
# print('androidid', a)
w = w + 1
time.sleep(10)
try:
allEvent().installUpload(i, ip, appkey)
# allEvent().formevent(i, ip, appkey)
except Exception:
print('install_wrong:', w)
w = w + 1
# time.sleep(10)
# try:
# allEvent().installUpload(i, ip, appkey)
# # allEvent().formevent(i, ip, appkey)
#
# except Exception:
# print('install_wrong:', w)
# w = w + 1
# #
# #
# time.sleep(5)
......@@ -231,20 +231,20 @@ for index in range(1):
# # except Exception:
# # print('retention',w)
# # w = w + 1
time.sleep(3)
try:
allEvent().adshow(i, ip, appkey,adid)
# allEvent().formevent(i, ip, appkey)
except Exception:
print('adshow_wrong:', w)
w = w + 1
time.sleep(3)
try:
allEvent().adclick(i, ip, appkey, adid)
# allEvent().formevent(i, ip, appkey)
except Exception:
print('adshow_wrong:', w)
w = w + 1
# time.sleep(3)
# try:
# allEvent().adshow(i, ip, appkey,adid)
# # allEvent().formevent(i, ip, appkey)
# except Exception:
# print('adshow_wrong:', w)
# w = w + 1
# time.sleep(3)
# try:
# allEvent().adclick(i, ip, appkey, adid)
# # allEvent().formevent(i, ip, appkey)
# except Exception:
# print('adshow_wrong:', w)
# w = w + 1
# time.sleep(5)
# try:
# allEvent().appduration(i, ip, appkey,se)
......@@ -270,14 +270,14 @@ for index in range(1):
# num = index + 1
# event = 'event_' + str(num)
event = 'event_1'
time.sleep(3)
try:
allEvent().ziding_event(i, ip, appkey, event)
print(event)
except Exception as err:
print(err)
print('自定义_wrong:', w)
# event = 'event_1'
# time.sleep(3)
# try:
# allEvent().ziding_event(i, ip, appkey, event)
# print(event)
# except Exception as err:
# print(err)
# print('自定义_wrong:', w)
......
import random
import requests
import json
import pytest
import time
import random
# 生成数字组合
n = 10
def code_nums(n=6):
ret = ''
for i in range(n):
num = random.randint(0, 9)
# letter = chr(random.randint(97, 122))
s = str(random.choice([num]))
ret += s
return ret
# 生成小写字母加数字组合
n = 10
def code_nums2(n=6):
ret = ''
for i in range(n):
num = random.randint(0, 9)
letter = chr(random.randint(97, 122))
s = str(random.choice([num, letter]))
ret += s
return ret
# 153字符
chaochang = '543214223221321321312131313133132131232131232132132543214223221321321312131313133132131232131232132132543214223221321321312131313133132131232131232132132'
......@@ -17,12 +48,13 @@ data = [
"application_info": {
# 线上-a8ed96ae9051499fd98bc46ab9c9495c
# 测试-decbeb4d840b4bcd1a068ca7233e6ac2
"appkey": "a8ed96ae9051499fd98bc46ab9c9495c",
"appkey": "2a33891fd3ea53f8edb0fca391a2432e",
"bundleid": "3423232",
"app_version": "1.9.0",
"channel_name": "HUAWEI"
},
"timestamp_info": {
"country": "chi",
"time_zone": "GMT+08",
"install_time": int(round(time.time() * 1000)),
"current_event_time": int(round(time.time() * 1000)),
......@@ -39,7 +71,7 @@ data = [
"device_id_type": "oaid",
"device_id_md5": "8e488a40a17aed2f6752f51382a4eafc",
"device_id_md5_type": "oaid_md5",
"os": "android",
"os": "1",
"os_version": "19",
"manufacturer": "HUAWEI",
"model": "Mate 40",
......@@ -69,15 +101,21 @@ data = [
"register_type": "WeChat",
"login_type": "Wechat",
"order_id": "2341242342676398724",
"order_amount": "343432",
"order_amount": "30",
"currency_type": "CNY",
"purchase_type": "Alipay",
"ad_platform": "csj",
"placement_type": "interstitial",
"placement_id": "23425334",
"ad_price": "4.34",
"ad_price_currency_type": "CNY",
"is_rendered": "1"
"ad_ecpm": "4.34",
# "ad_price_currency_type": "CNY",
"is_rendered": "1",
"ad_id": '',
"ad_appid": '',
"product_name": '',
"product_id": '',
"product_num": '',
"bid_type": ''
},
"custom_params": {
# "add_cart": "234234",
......@@ -96,15 +134,18 @@ data = [
data_temp = json.dumps(data)
def send_request():
global data
# url = "http://tkiomicro-receive-788931749.cn-north-1.elb.amazonaws.com.cn/receive/tkiov2/sdk"
url = "http://tkio-receive.solar-engine.com/receive/tkiov2/sdk"
# 对接se地址
# url = 'http://tmtest-se.trackingio.com/receive/tkiov2/sdk'
# 测试
url = "http://tmtest.trackingio.com/receive/tkiov2/sdk"
# 线上
# url = "http://tkio-receive.solar-engine.com/receive/tkiov2/sdk"
# data[0]['timestamp_info']['install_time'] = int(round(time.time() * 1000))
print(data)
response = requests.request("POST", url, headers=headers, data=json.dumps(data))
print(response.text)
# 全局data
data = json.loads(data_temp)
......@@ -116,6 +157,7 @@ def send_request():
def send_request2():
global data
url = "http://tkiomicro-receive-788931749.cn-north-1.elb.amazonaws.com.cn/receive/tkiov2/sdk"
data[0]['timestamp_info']['install_time'] = int(round(time.time() * 1000))
print(data)
......@@ -131,8 +173,10 @@ def send_request2():
def send_requests2s():
global data
# url = "http://tkiomicro-receive-788931749.cn-north-1.elb.amazonaws.com.cn/receive/tkiov2/s2s"
url = "http://tkio-receive.solar-engine.com/receive/tkiov2/s2s"
# 对接se地址
# url = 'http://tmtest-se.trackingio.com/receive/tkiov2/s2s'
url = "http://tmtest.trackingio.com/receive/tkiov2/s2s"
# url = "http://tkio-receive.solar-engine.com/receive/tkiov2/s2s"
response = requests.request("POST", url, headers=headers, data=json.dumps(data))
print(response.text)
......@@ -146,7 +190,6 @@ def send_requests2s():
# 批量上报的数据中存在异常数据
def test_piliang():
# data.append(data[0])
# data[1]['event_info'] = '1'
# data.append(data[0])
......@@ -162,6 +205,8 @@ def test_piliang():
data.append(first)
response = send_request()
assert response["status"] == "406"
#
#
# 批量上报的数据超过100条
......@@ -173,7 +218,6 @@ def test_piliang2():
assert response["status"] == "407"
# -------------------------应用信息-------------------------
# application_info为空
def test_appinfo_empty():
......@@ -243,15 +287,14 @@ def test_app_version3():
# channel_name传HUAWEI,os为iOS
def test_channel_name_error():
data[0]["application_info"]["channel_name"] = "HUAWEI"
data[0]["device_info"]["os"] = "ios"
data[0]["device_info"]["os"] = "2"
response = send_request()
assert response["status"] == "104"
def test_channel_name():
data[0]["application_info"]["channel_name"] = "HUAWEI"
data[0]["device_info"]["os"] = "android"
data[0]["device_info"]["os"] = "1"
response = send_request()
assert response["status"] == "0"
......@@ -286,6 +329,7 @@ def test_time_zone_empty():
assert response["status"] == "106"
# ------------------receive接口迭代-----------
# time_zone不等于6个字符
def test_time_zone__illegal_length():
data[0]["timestamp_info"]["time_zone"] = chaochang
......@@ -318,16 +362,44 @@ def test_time_zone3():
def test_time_zone4():
data[0]["timestamp_info"]["time_zone"] = "%¥"
response = send_request()
assert response["status"] == "0"
# time_zone为17字符,返回106
def test_time_zone5():
data[0]["timestamp_info"]["time_zone"] = code_nums(17)
response = send_request()
assert response["status"] == "106"
# install_time为空
# time_zone为16字符,返回0
def test_time_zone5():
data[0]["timestamp_info"]["time_zone"] = code_nums(16)
response = send_request()
assert response["status"] == "0"
# -----------------------receive接口迭代-------------
# install_time为空,event_name为install,返回107
def test_install_time_empty():
data[0]["timestamp_info"]["install_time"] = ""
data[0]["event_info"]["event_name"] = "install"
response = send_request()
assert response["status"] == "107"
# install_time为空,event_name为非install,返回0
def test_install_time_empty1():
newList = ['startup', 'register', 'login', 'order', 'purchase',
'adimpression', 'adclick']
for event in newList:
data[0]["timestamp_info"]["install_time"] = ""
data[0]["event_info"]['event_name'] = event
data[0]["event_info"]['event_type'] = 'preset'
response = send_request()
assert response["status"] == "0"
# install_time不等于13个字符
def test_install_time_illegal_length():
data[0]["timestamp_info"]["install_time"] = chaochang
......@@ -512,7 +584,6 @@ def test_collector_version_illegal_length():
assert response["status"] == "112"
# collector_version等于5个字符,但不是规范版本
def test_collector_version2():
data[0]["collector_info"]["collector_version"] = '11111'
......@@ -520,7 +591,6 @@ def test_collector_version2():
assert response["status"] == "0"
# collector_version等于5个字符,规范版本
def test_collector_version3():
data[0]["collector_info"]["collector_version"] = '1.8.0'
......@@ -528,7 +598,6 @@ def test_collector_version3():
assert response["status"] == "0"
# retried_times为空
def test_retried_times_empty():
data[0]["collector_info"]["retried_times"] = ""
......@@ -543,7 +612,6 @@ def test_retried_times_illegal_length():
assert response["status"] == "113"
# -------------------------终端设备信息-------------------------
......@@ -555,11 +623,10 @@ def test_device_info_empty():
# os为android
def test_os_android():
def test_os_android1():
data[0]["device_info"]["os"] = 'android'
response = send_request()
assert response["status"] == "0"
assert response["status"] == "115"
# os为大写ANDROID
......@@ -571,7 +638,7 @@ def test_os_android():
# os为ios,channel_name等于default,没有传idfa等iOS相关参数
def test_os_ios2():
data[0]["device_info"]["os"] = 'ios'
data[0]["device_info"]["os"] = '2'
data[0]['application_info']['channel_name'] = 'default'
response = send_request()
assert response["status"] == "124"
......@@ -584,9 +651,9 @@ def test_os_empty():
assert response["status"] == "115"
# os为web
# os为Windows
def test_os_web():
data[0]["device_info"]["os"] = 'web'
data[0]["device_info"]["os"] = '3'
response = send_request()
assert response["status"] == "0"
......@@ -642,8 +709,6 @@ def test_manufacturer3():
assert response["status"] == "0"
# model为空
def test_model_empty():
data[0]["device_info"]["model"] = ""
......@@ -665,8 +730,6 @@ def test_model_illegal_length():
assert response["status"] == "0"
# ipv4 格式非*.*.*.*
def test_ipv4():
data[0]["device_info"]["ipv4"] = "12.2"
......@@ -681,8 +744,6 @@ def test_ipv4_illegal_length():
assert response["status"] == "119"
# 集成方式为s2s,ipv4不传
def test_ipv4_s2s():
data[0]["device_info"]["ipv4"] = ""
......@@ -699,8 +760,6 @@ def test_ipv4_s2s2():
assert response["status"] == "0"
# 集成方式为s2s,ipv6不传
def test_ipv6_s2s():
data[0]["device_info"]["ipv6"] = ""
......@@ -725,8 +784,6 @@ def test_ipv6_illegal_length():
assert response["status"] == "120"
# ua为空,os为android
def test_ua_androidempty():
data[0]["device_info"]["ua"] = ""
......@@ -735,7 +792,6 @@ def test_ua_androidempty():
assert response["status"] == "0"
# ua为空,os为web
def test_ua_androidempty():
data[0]["device_info"]["ua"] = ""
......@@ -747,22 +803,20 @@ def test_ua_androidempty():
# ua为空,os为iOS
def test_ua_iosempty():
data[0]["device_info"]["ua"] = ""
data[0]["device_info"]["os"] = 'ios'
data[0]["device_info"]["os"] = '2'
data[0]["application_info"]["channel_name"] = 'default'
response = send_request()
assert response["status"] == "121"
# ua不为空,但是是无法解析的ua
def test_ua_androidempty():
data[0]["device_info"]["ua"] = "11111"
data[0]["device_info"]["os"] = 'web'
data[0]["device_info"]["os"] = '4'
response = send_request()
assert response["status"] == "0"
# os为android,att_status为空
def test_uatt_statusempty():
data[0]["device_info"]["att_status"] = ""
......@@ -770,7 +824,6 @@ def test_uatt_statusempty():
assert response["status"] == "0"
# os为android,lat_status为空
def test_lat_statusempt():
data[0]["device_info"]["att_status"] = ""
......@@ -778,7 +831,6 @@ def test_lat_statusempt():
assert response["status"] == "0"
# oaid为空
def test_oaidempty():
data[0]["device_info"]["oaid"] = ""
......@@ -810,6 +862,7 @@ def test_oaid_md5_empty():
response = send_request()
assert response["status"] == "0"
# ios系统,上报oaid,oaid_md5,imei1,imei1_md5,imei2,imei2_md5,gaid,gaid_md5,mac,mac_md5,android_id,android_id_md5,在"3237receiveios"脚本里
......@@ -1093,6 +1146,13 @@ def test_device_id_type_empty2():
assert response["status"] == "138"
# device_id_type为one_id
def test_device_id_type_empty3():
data[0]["device_info"]["device_id_type"] = 'one_id'
response = send_request()
assert response["status"] == "0"
# device_id为空,device_id_md5不为空
def test_device_idmd5_empty():
data[0]["device_info"]["device_id"] = ''
......@@ -1257,21 +1317,21 @@ def test_event_type():
def test_event_data():
data[0]["event_info"]["event_data"] = ""
response = send_request()
assert response["status"] == "145"
assert response["status"] == "0"
# user_id为空
def test_user_id1():
data[0]["event_info"]["event_data"]['user_id'] = ""
response = send_request()
assert response["status"] == "146"
assert response["status"] == "0"
# user_id超长
def test_user_id2():
data[0]["event_info"]["event_data"]['user_id'] = chaochang
response = send_request()
assert response["status"] == "146"
assert response["status"] == "0"
# 事件为install时,user_id为-1
......@@ -1294,7 +1354,7 @@ def test_user_id4():
def test_register_type1():
data[0]["event_info"]["event_data"]['register_type'] = chaochang
response = send_request()
assert response["status"] == "147"
assert response["status"] == "0"
# event_name为register,register_type为空
......@@ -1302,7 +1362,7 @@ def test_register_type2():
data[0]["event_info"]["event_data"]['register_type'] = ""
data[0]['event_info']['event_name'] = 'register'
response = send_request()
assert response["status"] == "147"
assert response["status"] == "0"
# event_name为register,register_type不为空
......@@ -1340,7 +1400,7 @@ def test_register_type5():
def test_login_type1():
data[0]["event_info"]["event_data"]['login_type'] = chaochang
response = send_request()
assert response["status"] == "148"
assert response["status"] == "0"
# event_name为login,login_type为空
......@@ -1348,7 +1408,7 @@ def test_login_type2():
data[0]["event_info"]["event_data"]['login_type'] = ""
data[0]['event_info']['event_name'] = 'login'
response = send_request()
assert response["status"] == "148"
assert response["status"] == "0"
# event_name为login,login_type不为空
......@@ -1387,7 +1447,7 @@ def test_login_type5():
def test_order_id1():
data[0]["event_info"]["event_data"]['order_id'] = chaochang
response = send_request()
assert response["status"] == "149"
assert response["status"] == "0"
# event_name为order,order_id为空
......@@ -1395,7 +1455,7 @@ def test_order_id2():
data[0]["event_info"]["event_data"]['order_id'] = ""
data[0]['event_info']['event_name'] = 'order'
response = send_request()
assert response["status"] == "149"
assert response["status"] == "0"
# event_name为order,order_id不为空
......@@ -1433,14 +1493,14 @@ def test_order_id6():
data[0]["event_info"]["event_data"]['order_id'] = ""
data[0]['event_info']['event_name'] = 'purchase'
response = send_request()
assert response["status"] == "149"
assert response["status"] == "0"
# order_amount非0以及正整数
def test_order_amount1():
data[0]["event_info"]["event_data"]['order_amount'] = "23.232131"
response = send_request()
assert response["status"] == "150"
assert response["status"] == "0"
# event_name为order,order_amount为空
......@@ -1448,7 +1508,7 @@ def test_order_amount2():
data[0]["event_info"]["event_data"]['order_amount'] = ""
data[0]['event_info']['event_name'] = 'order'
response = send_request()
assert response["status"] == "150"
assert response["status"] == "0"
# event_name为order,order_amount不为空
......@@ -1486,7 +1546,7 @@ def test_order_amount6():
data[0]["event_info"]["event_data"]['order_amount'] = ""
data[0]['event_info']['event_name'] = 'purchase'
response = send_request()
assert response["status"] == "150"
assert response["status"] == "0"
# event_name为purchase,order_amount不为空
......@@ -1502,7 +1562,7 @@ def test_currency_type1():
data[0]['event_info']['event_data']['currency_type'] = ''
data[0]['event_info']['event_name'] = 'purchase'
response = send_request()
assert response["status"] == "151"
assert response["status"] == "0"
# event_name为purchase,currency_type不为空
......@@ -1518,7 +1578,7 @@ def test_currency_type3():
data[0]['event_info']['event_data']['currency_type'] = 'aa'
data[0]['event_info']['event_name'] = 'purchase'
response = send_request()
assert response["status"] == "151"
assert response["status"] == "0"
# event_name为非purchase,currency_type为空
......@@ -1536,7 +1596,7 @@ def test_purchase_type1():
data[0]['event_info']['event_data']['purchase_type'] = ''
data[0]['event_info']['event_name'] = 'purchase'
response = send_request()
assert response["status"] == "152"
assert response["status"] == "0"
# event_name为purchase,purchase_type不为空
......@@ -1562,7 +1622,7 @@ def test_purchase_type4():
data[0]['event_info']['event_data']['purchase_type'] = chaochang
data[0]['event_info']['event_name'] = 'purchase'
response = send_request()
assert response["status"] == "152"
assert response["status"] == "0"
# event_name为adimpression和adclick,ad_platform为空
......@@ -1572,7 +1632,7 @@ def test_ad_platform1():
data[0]["event_info"]['event_data']['ad_platform'] = ''
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "153"
assert response["status"] == "0"
# event_name为adimpression和adclick,ad_platform不为空
......@@ -1610,7 +1670,7 @@ def test_ad_platform5():
data[0]["event_info"]['event_data']['ad_platform'] = chaochang
data[0]['event_info']['event_name'] = "adclick"
response = send_request()
assert response["status"] == "153"
assert response["status"] == "0"
# # event_name为adimpression和adclick,placement_type为空
......@@ -1620,7 +1680,7 @@ def test_placement_type1():
data[0]["event_info"]['event_data']['placement_type'] = ''
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "154"
assert response["status"] == "0"
# # event_name为adimpression和adclick,placement_type不为空
......@@ -1668,7 +1728,7 @@ def test_placement_id1():
data[0]["event_info"]['event_data']['placement_id'] = ''
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "155"
assert response["status"] == "0"
# # event_name为adimpression和adclick,placement_id不为空
......@@ -1706,95 +1766,96 @@ def test_placement_type5():
data[0]["event_info"]['event_data']['placement_id'] = chaochang
data[0]['event_info']['event_name'] = "adclick"
response = send_request()
assert response["status"] == "155"
assert response["status"] == "0"
# event_name为adimpression,ad_price为空
# event_name为adimpression,ad_ecpm为空,返回0
def test_ad_price1():
data[0]["event_info"]['event_data']['ad_price'] = ''
data[0]["event_info"]['event_data']['ad_ecpm'] = ''
data[0]['event_info']['event_name'] = 'adimpression'
response = send_request()
assert response["status"] == "156"
assert response["status"] == "0"
# event_name为adimpression,ad_price不为空
# event_name为adimpression,ad_ecpm不为空
def test_ad_price2():
data[0]["event_info"]['event_data']['ad_price'] = '765453434'
data[0]["event_info"]['event_data']['ad_ecpm'] = '765453434'
data[0]['event_info']['event_name'] = 'adimpression'
response = send_request()
assert response["status"] == "0"
# event_name非adimpression,ad_price为空
# event_name非adimpression,ad_ecpm为空
def test_ad_price3():
newlist = ['install', 'startup', 'register', 'login', 'order', 'purchase', 'adclick']
for event in newlist:
data[0]["event_info"]['event_data']['ad_price'] = ''
data[0]["event_info"]['event_data']['ad_ecpm'] = ''
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "0"
# event_name非adimpression,ad_price不为空
# event_name非adimpression,ad_ecpm不为空
def test_ad_price4():
newlist = ['install', 'startup', 'register', 'login', 'order', 'purchase', 'adclick']
for event in newlist:
data[0]["event_info"]['event_data']['ad_price'] = '98765434567654'
data[0]["event_info"]['event_data']['ad_ecpm'] = '98765434567654'
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "0"
# ad_price超长
# ad_ecpm超长,返回0
def test_ad_price5():
data[0]["event_info"]['event_data']['ad_price'] = chaochang
data[0]["event_info"]['event_data']['ad_ecpm'] = chaochang
data[0]['event_info']['event_name'] = "adimpression"
response = send_request()
assert response["status"] == "156"
# event_name为adimpression,ad_price_currency_type为空
def test_ad_price_currency_type1():
data[0]["event_info"]['event_data']['ad_price_currency_type'] = ''
data[0]['event_info']['event_name'] = 'adimpression'
response = send_request()
assert response["status"] == "157"
# event_name为adimpression,ad_price_currency_type不为空
def test_ad_price_currency_type2():
data[0]["event_info"]['event_data']['ad_price_currency_type'] = 'CNY'
data[0]['event_info']['event_name'] = 'adimpression'
response = send_request()
assert response["status"] == "0"
# event_name非adimpression,ad_price_currency_type为空
def test_ad_price_currency_type3():
newlist = ['install', 'startup', 'register', 'login', 'order', 'purchase', 'adclick']
for event in newlist:
data[0]["event_info"]['event_data']['ad_price_currency_type'] = ''
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "0"
# event_name非adimpression,ad_price_currency_type不为空
def test_ad_price_currency_type4():
newlist = ['install', 'startup', 'register', 'login', 'order', 'purchase', 'adclick']
for event in newlist:
data[0]["event_info"]['event_data']['ad_price_currency_type'] = 'CNY'
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "0"
# ad_price_currency_type非三个字符
def test_ad_price_currency_type5():
data[0]["event_info"]['event_data']['ad_price_currency_type'] = "0"
data[0]['event_info']['event_name'] = "adimpression"
response = send_request()
assert response["status"] == "157"
# -------------------receive接口迭代-------------
# # event_name为adimpression,ad_price_currency_type为空
# def test_ad_price_currency_type1():
# data[0]["event_info"]['event_data']['ad_price_currency_type'] = ''
# data[0]['event_info']['event_name'] = 'adimpression'
# response = send_request()
# assert response["status"] == "157"
#
#
# # event_name为adimpression,ad_price_currency_type不为空
# def test_ad_price_currency_type2():
# data[0]["event_info"]['event_data']['ad_price_currency_type'] = 'CNY'
# data[0]['event_info']['event_name'] = 'adimpression'
# response = send_request()
# assert response["status"] == "0"
#
#
# # event_name非adimpression,ad_price_currency_type为空
# def test_ad_price_currency_type3():
# newlist = ['install', 'startup', 'register', 'login', 'order', 'purchase', 'adclick']
# for event in newlist:
# data[0]["event_info"]['event_data']['ad_price_currency_type'] = ''
# data[0]['event_info']['event_name'] = event
# response = send_request()
# assert response["status"] == "0"
#
#
# # event_name非adimpression,ad_price_currency_type不为空
# def test_ad_price_currency_type4():
# newlist = ['install', 'startup', 'register', 'login', 'order', 'purchase', 'adclick']
# for event in newlist:
# data[0]["event_info"]['event_data']['ad_price_currency_type'] = 'CNY'
# data[0]['event_info']['event_name'] = event
# response = send_request()
# assert response["status"] == "0"
#
#
# # ad_price_currency_type非三个字符
# def test_ad_price_currency_type5():
# data[0]["event_info"]['event_data']['ad_price_currency_type'] = "0"
# data[0]['event_info']['event_name'] = "adimpression"
# response = send_request()
# assert response["status"] == "157"
# is_rendered为空
......@@ -1822,7 +1883,7 @@ def test_is_rendered3():
def test_is_rendered3():
data[0]['event_info']['event_data']['is_rendered'] = 'qqq'
response = send_request()
assert response["status"] == "158"
assert response["status"] == "0"
# custom_params为空,已在postman执行
......@@ -1896,6 +1957,256 @@ def test_custom_params3():
# response = send_request()
# assert response["status"] == "0"
# country为空
def test_country1():
data[0]['timestamp_info']['country'] = ''
response = send_request()
assert response["status"] == "216"
# country为16个字符
def test_country2():
data[0]['timestamp_info']['country'] = code_nums(16)
response = send_request()
assert response["status"] == "0"
# country为17个字符
def test_country3():
data[0]['timestamp_info']['country'] = code_nums(17)
response = send_request()
assert response["status"] == "216"
# country包含特殊字符
def test_country4():
data[0]['timestamp_info']['country'] = '312@!#@!三大程'
response = send_request()
assert response["status"] == "0"
# language为空
def test_language1():
data[0]['device_info']['language'] = ''
response = send_request()
assert response["status"] == "0"
# language为32字符
def test_language2():
data[0]['device_info']['language'] = code_nums2(32)
response = send_request()
assert response["status"] == "0"
# language为33字符
def test_language3():
data[0]['device_info']['language'] = code_nums2(33)
response = send_request()
assert response["status"] == "217"
# language包含中文
def test_language4():
data[0]['device_info']['language'] = '测试测试语言'
response = send_request()
assert response["status"] == "0"
# language包含特殊字符
def test_language5():
data[0]['device_info']['language'] = '测试测试语@#¥言'
response = send_request()
assert response["status"] == "0"
# device_type为空
def test_device_type1():
data[0]['device_info']['device_type'] = ''
response = send_request()
assert response["status"] == "0"
# device_type为16字符
def test_device_type2():
data[0]['device_info']['device_type'] = code_nums2(16)
response = send_request()
assert response["status"] == "0"
# device_type为17字符
def test_device_type3():
data[0]['device_info']['device_type'] = code_nums2(17)
response = send_request()
assert response["status"] == "218"
# device_type包含中文
def test_device_type4():
data[0]['device_info']['device_type'] = '测试测试语言'
response = send_request()
assert response["status"] == "0"
# device_type包含特殊字符
def test_device_type5():
data[0]['device_info']['device_type'] = '测试测试语@#¥言'
response = send_request()
assert response["status"] == "0"
# device_type为15字符
def test_device_type6():
data[0]['device_info']['device_type'] = code_nums2(15)
response = send_request()
assert response["status"] == "0"
# device_type为15字符
def test_device_type6():
data[0]['device_info']['device_type'] = code_nums2(15)
response = send_request()
assert response["status"] == "0"
# ad_id为空
def test_ad_id1():
data[0]['event_info']['event_data']['ad_id'] = ''
response = send_request()
assert response["status"] == "0"
# ad_id为100字符
def test_ad_id2():
data[0]['event_info']['event_data']['ad_id'] = code_nums2(100)
response = send_request()
assert response["status"] == "0"
# ad_id包含特殊字符和汉字
def test_ad_id3():
data[0]['event_info']['event_data']['ad_id'] = '测试#@#'
response = send_request()
assert response["status"] == "0"
# ad_appid为空
def test_ad_appid1():
data[0]['event_info']['event_data']['ad_appid'] = ''
response = send_request()
assert response["status"] == "0"
# ad_appid为100字符
def test_ad_appid2():
data[0]['event_info']['event_data']['ad_appid'] = code_nums2(100)
response = send_request()
assert response["status"] == "0"
# ad_appid包含特殊字符和汉字
def test_ad_appid3():
data[0]['event_info']['event_data']['ad_appid'] = '测试#@#'
response = send_request()
assert response["status"] == "0"
# product_name为空
def test_product_name1():
data[0]['event_info']['event_data']['product_name'] = ''
response = send_request()
assert response["status"] == "0"
# product_name为100字符
def test_product_name2():
data[0]['event_info']['event_data']['product_name'] = code_nums2(100)
response = send_request()
assert response["status"] == "0"
# product_name包含特殊字符和汉字
def test_product_name3():
data[0]['event_info']['event_data']['product_name'] = '测试#@_+#'
response = send_request()
assert response["status"] == "0"
# product_id为空
def test_product_id1():
data[0]['event_info']['event_data']['product_id'] = ''
response = send_request()
assert response["status"] == "0"
# product_id为100字符
def test_product_id2():
data[0]['event_info']['event_data']['product_id'] = code_nums2(100)
response = send_request()
assert response["status"] == "0"
# product_id包含特殊字符和汉字
def test_product_id3():
data[0]['event_info']['event_data']['product_id'] = '测试#@_+#'
response = send_request()
assert response["status"] == "0"
# product_num为空
def test_product_num1():
data[0]['event_info']['event_data']['product_num'] = ''
response = send_request()
assert response["status"] == "0"
# product_num为100字符
def test_product_num2():
data[0]['event_info']['event_data']['product_num'] = code_nums2(100)
response = send_request()
assert response["status"] == "0"
# product_num包含特殊字符和汉字
def test_product_num3():
data[0]['event_info']['event_data']['product_num'] = '测试#@_+#'
response = send_request()
assert response["status"] == "0"
# product_num为number类型
def test_product_num4():
data[0]['event_info']['event_data']['product_num'] = 232
response = send_request()
assert response["status"] == "0"
# bid_type为空
def test_bid_type1():
data[0]['event_info']['event_data']['bid_type'] = ''
response = send_request()
assert response["status"] == "0"
# bid_type为100字符
def test_bid_type2():
data[0]['event_info']['event_data']['bid_type'] = code_nums2(100)
response = send_request()
assert response["status"] == "0"
# bid_type包含特殊字符和汉字
def test_bid_type3():
data[0]['event_info']['event_data']['bid_type'] = '测试#@_+#'
data[0]["collector_info"]["integration_type"] = "s2s"
# response = send_request()
response = send_requests2s()
assert response["status"] == "0"
......
......@@ -37,14 +37,15 @@ global data
data = [
{
"application_info": {
# 线上-
# 测试-
"appkey": "2c81418e218b4879b904a45530f0a09e",
# 线上-55705dbd45dd246751b87bba94b8c73c
# 测试-55705dbd45dd246751b87bba94b8c73c
"appkey": "2a33891fd3ea53f8edb0fca391a2432e",
"bundleid": "3423232",
"app_version": "1.9.0",
"channel_name": "default"
},
"timestamp_info": {
"country": "chi",
"time_zone": "GMT+08",
"install_time": int(round(time.time() * 1000)),
"current_event_time": int(round(time.time() * 1000)),
......@@ -61,7 +62,7 @@ data = [
"device_id_type": "idfa_md5",
"device_id_md5": "c3381276ae145b3663c8e0f6dd9f628a",
"device_id_md5_type": "idfa_md5",
"os": "ios",
"os": "2",
"os_version": "19",
"manufacturer": "HUAWEI",
"model": "Mate 40",
......@@ -158,10 +159,12 @@ data_temp = json.dumps(data)
def send_request():
global data
# 对接se地址
# url = 'http://tmtest-se.trackingio.com/receive/tkiov2/sdk'
# 测试
# url = "http://tmtest.trackingio.com/receive/tkiov2/sdk"
url = "http://tmtest.trackingio.com/receive/tkiov2/sdk"
# 线上
url = "http://tkio-receive.solar-engine.com/receive/tkiov2/sdk"
# url = "http://tkio-receive.solar-engine.com/receive/tkiov2/sdk"
data[0]['timestamp_info']['install_time'] = int(round(time.time() * 1000))
data[0]['timestamp_info']['current_event_time'] = int(round(time.time() * 1000))
......@@ -194,6 +197,22 @@ def send_request2():
return response
# iad_retry_times为num型,应该返回214,但是实时接收时接收到的是string类型,无法判断number
def test_se1():
data[0]["asa_info"]["iad_info"]['iad_retry_times'] = 3
response = send_request()
assert response["status"] == "0"
# iad_retry_times为num型,同上test_se1
def test_se2():
data[0]["asa_info"]["adservices_info"]['adservices_retry_times'] = 3
response = send_request()
assert response["status"] == "0"
# os为ios,channel_name不等于default
def test_os_ios():
data[0]["device_info"]["os"] = 'ios'
......
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