smartpush 1.3.7__tar.gz → 1.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {smartpush-1.3.7 → smartpush-1.3.8}/PKG-INFO +1 -1
- {smartpush-1.3.7 → smartpush-1.3.8}/setup.py +1 -1
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/flow/MockFlow.py +46 -16
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/test.py +10 -2
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/utils/ListDictUtils.py +0 -1
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush.egg-info/PKG-INFO +1 -1
- {smartpush-1.3.7 → smartpush-1.3.8}/README.md +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/setup.cfg +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/__init__.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/export/__init__.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/export/basic/ExcelExportChecker.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/export/basic/GetOssUrl.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/export/basic/ReadExcel.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/export/basic/__init__.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/flow/__init__.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/get_jira_info.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/utils/DataTypeUtils.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/utils/StringUtils.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush/utils/__init__.py +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush.egg-info/SOURCES.txt +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush.egg-info/dependency_links.txt +0 -0
- {smartpush-1.3.7 → smartpush-1.3.8}/smartpush.egg-info/top_level.txt +0 -0
@@ -5,7 +5,7 @@ import requests
|
|
5
5
|
from smartpush.utils import ListDictUtils
|
6
6
|
|
7
7
|
|
8
|
-
def get_current_flow(host_domain, cookies, flow_id
|
8
|
+
def get_current_flow(host_domain, cookies, flow_id):
|
9
9
|
# 提取flow所有节点数据
|
10
10
|
_url = host_domain + "/flow/getFlowDetail"
|
11
11
|
headers = {
|
@@ -17,18 +17,51 @@ def get_current_flow(host_domain, cookies, flow_id, oppor="forward"):
|
|
17
17
|
"includeActivityDetail": True
|
18
18
|
}
|
19
19
|
result = json.loads(requests.request(method="get", url=_url, headers=headers, params=params).text)
|
20
|
-
|
21
20
|
# 按节点id存储
|
22
21
|
node_counts = []
|
23
|
-
|
22
|
+
|
23
|
+
def process_node(node):
|
24
24
|
node_counts.append({node["id"]: {"completedCount": node["data"]["completedCount"],
|
25
25
|
"skippedCount": node["data"]["skippedCount"],
|
26
26
|
"openUserCount": node["data"]["openUserCount"],
|
27
27
|
"clickUserCount": node["data"]["clickUserCount"],
|
28
|
-
"waitingCount": node["data"]["waitingCount"]
|
28
|
+
"waitingCount": node["data"]["waitingCount"]
|
29
|
+
}
|
29
30
|
}
|
30
31
|
)
|
31
|
-
|
32
|
+
# 处理split节点
|
33
|
+
if "split" in node["data"].keys():
|
34
|
+
for branch_node in node['data']['split']['branches']["false"]:
|
35
|
+
process_node(branch_node)
|
36
|
+
for branch_node in node['data']['split']['branches']["true"]:
|
37
|
+
process_node(branch_node)
|
38
|
+
# 处理abTesting节点
|
39
|
+
elif "abTesting" in node["data"].keys():
|
40
|
+
for branch_node in node['data']['abTesting']['branches']["a"]:
|
41
|
+
process_node(branch_node)
|
42
|
+
for branch_node in node['data']['abTesting']['branches']["b"]:
|
43
|
+
process_node(branch_node)
|
44
|
+
|
45
|
+
# 处理所有顶层节点
|
46
|
+
for node in result['resultData']['nodes']:
|
47
|
+
process_node(node)
|
48
|
+
return node_counts, result["resultData"]["version"]
|
49
|
+
|
50
|
+
|
51
|
+
def update_flow(host_domain, cookies, **kwargs):
|
52
|
+
"""
|
53
|
+
# 更新flow
|
54
|
+
update_flow_params: 必填,saveFlow接口所有参数,dict格式
|
55
|
+
version: 非必填,flow版本号
|
56
|
+
"""
|
57
|
+
_url = host_domain + "/flow/saveFlow"
|
58
|
+
headers = {
|
59
|
+
"cookie": cookies,
|
60
|
+
"Content-Type": "application/json"
|
61
|
+
}
|
62
|
+
kwargs["update_flow_params"]["version"] = kwargs.get("version", kwargs["update_flow_params"]["version"])
|
63
|
+
params = kwargs["update_flow_params"]
|
64
|
+
result = requests.request(method="post", url=_url, headers=headers, json=params).text
|
32
65
|
|
33
66
|
|
34
67
|
def start_flow(host_domain, cookies, flow_id, version):
|
@@ -46,18 +79,10 @@ def start_flow(host_domain, cookies, flow_id, version):
|
|
46
79
|
|
47
80
|
|
48
81
|
def mock_pulsar(mock_domain, pulsar, limit=1):
|
82
|
+
"""
|
49
83
|
# post请求
|
50
84
|
# times:为触发次数,默认1次即可
|
51
|
-
|
52
|
-
# 需参数化字段:
|
53
|
-
# abandonedOrderId、checkoutId、controlObjectId取第一步control_object_id做参数化
|
54
|
-
# platform为平台字段,枚举: 1:SF 2:ec1 4:ec2 8:domain
|
55
|
-
# messageId:需更改,保证不是之前使用过的
|
56
|
-
# userId:需参数化,兼容不同平台和环境
|
57
|
-
# handle、storeId:兼容不同店铺
|
58
|
-
#
|
59
|
-
# 备注:
|
60
|
-
# 可通过弃单id、userId字段测异常场景:如无联系人时,能触发但不发送,记录跳过数等;
|
85
|
+
"""
|
61
86
|
_url = mock_domain + "/flow/testEventMulti"
|
62
87
|
headers = {
|
63
88
|
"Content-Type": "application/json"
|
@@ -83,10 +108,15 @@ def check_flow(mock_domain, host_domain, cookies, **kwargs):
|
|
83
108
|
pulsar:必填,模拟的触发数据
|
84
109
|
limit:非必填,默认为1 - mock_pulsar函数用于控制模拟触发的次数
|
85
110
|
num:非必填,默认为1 - compare_lists函数用于断言方法做差值计算
|
111
|
+
update_flow_params: 非必填,dict格式,需更新flow时传参,参数结构为sp的saveFlow接口内容
|
86
112
|
"""
|
87
113
|
# 触发前提取flow数据,后续做对比
|
88
114
|
old_flow_counts, old_versions = get_current_flow(host_domain=host_domain, cookies=cookies,
|
89
115
|
flow_id=kwargs["flow_id"])
|
116
|
+
# 更新flow
|
117
|
+
if kwargs.get("update_flow_params", False):
|
118
|
+
update_flow(host_domain=host_domain, cookies=cookies, update_flow_params=kwargs.get("update_flow_params"),
|
119
|
+
version=old_versions)
|
90
120
|
# 启动flow
|
91
121
|
start_flow(host_domain=host_domain, cookies=cookies, flow_id=kwargs["flow_id"], version=old_versions)
|
92
122
|
# 触发flow
|
@@ -97,4 +127,4 @@ def check_flow(mock_domain, host_domain, cookies, **kwargs):
|
|
97
127
|
flow_id=kwargs["flow_id"])
|
98
128
|
# 断言
|
99
129
|
result = ListDictUtils.compare_lists(temp1=old_flow_counts, temp2=new_flow_counts, num=kwargs.get("num", 1))
|
100
|
-
return [True, "断言成功"] if len(result) == 0 else [False, result]
|
130
|
+
return [True, "断言成功"] if len(result) == 0 else [False, result]
|
@@ -31,13 +31,17 @@ if __name__ == '__main__':
|
|
31
31
|
# print(check_excel_all(actual_oss=oss1, expected_oss=oss2,skiprows =1))
|
32
32
|
# print(check_excel_all(actual_oss=oss1, expected_oss=oss2,ignore_sort=True))
|
33
33
|
# print(check_excel_all(actual_oss=a_person_oss2, expected_oss=e_person_oss1, check_type="including"))
|
34
|
-
print(ExcelExportChecker.check_excel_all(actual_oss=oss3, expected_oss=oss4, check_type="including"))
|
34
|
+
# print(ExcelExportChecker.check_excel_all(actual_oss=oss3, expected_oss=oss4, check_type="including"))
|
35
35
|
# read_excel_csv_data(type=)
|
36
36
|
# print(DataTypeUtils().check_email_format())
|
37
37
|
# errors = ExcelExportChecker.check_field_format(actual_oss=oss1, fileds={0: {5: "time"}}, skiprows=1)
|
38
38
|
# ExcelExportChecker.check_excel_name(actual_oss=oss1, expected_oss=url)
|
39
39
|
|
40
40
|
_url = "http://sp-go-flow-test.inshopline.com"
|
41
|
+
host_domain = "https://test.smartpushedm.com/api-em-ec2"
|
42
|
+
cookies = "_ga=GA1.1.88071637.1717860341; _ga_NE61JB8ZM6=GS1.1.1718954972.32.1.1718954972.0.0.0; _ga_Z8N3C69PPP=GS1.1.1723104149.2.0.1723104149.0.0.0; _ga_D2KXR23WN3=GS1.1.1735096783.3.1.1735096812.0.0.0; osudb_lang=; a_lang=zh-hans-cn; osudb_uid=4213785218; osudb_oar=#01#SID0000126BGKWZjG4n42Q2CwFh4CS1WDoQZHTsZddVzHm5AvTJYrgIBGBQYLWO+XpYs47JMugUA6ZpHRvCdRTXw0OLXxpvdGnuT8GZ5qgcuWxiOIUHwdOCKPO9aEBTTB6NWeShMEFpZlU9lLxzcYL6HLlPBHe; osudb_appid=SMARTPUSH; osudb_subappid=1; ecom_http_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDc1MzQzMjYsImp0aSI6IjVlMTMyOWU3LTAwMzItNDIyNS1hY2NmLWFlNDY4ZTUxZDgxMiIsInVzZXJJbmZvIjp7ImlkIjowLCJ1c2VySWQiOiI0MjEzNzg1MjE4IiwidXNlcm5hbWUiOiIiLCJlbWFpbCI6InRlc3RzbWFydDA5NUBnbWFpbC5jb20iLCJ1c2VyUm9sZSI6Im93bmVyIiwicGxhdGZvcm1UeXBlIjo3LCJzdWJQbGF0Zm9ybSI6MSwicGhvbmUiOiIiLCJsYW5ndWFnZSI6InpoLWhhbnMtY24iLCJhdXRoVHlwZSI6IiIsImF0dHJpYnV0ZXMiOnsiY291bnRyeUNvZGUiOiJDTiIsImN1cnJlbmN5IjoiVVNEIiwiY3VycmVuY3lTeW1ib2wiOiJVUyQiLCJkb21haW4iOiJmZWxpeC10Yy5teXNob3BsaW5lc3RnLmNvbSIsImxhbmd1YWdlIjoiZW4iLCJtZXJjaGFudEVtYWlsIjoidGVzdHNtYXJ0MDk1QGdtYWlsLmNvbSIsIm1lcmNoYW50TmFtZSI6ImZlbGl4LXRjIiwicGhvbmUiOiIiLCJzY29wZUNoYW5nZWQiOnRydWUsInN0YWZmTGFuZ3VhZ2UiOm51bGwsInN0YXR1cyI6MiwidGltZXpvbmUiOiJBc2lhL0hvbmdfS29uZyJ9LCJzdG9yZUlkIjoiMTY2NTY2MTA4NDM2MyIsImhhbmRsZSI6ImZlbGl4LXRjIiwiZW52IjoiQ04iLCJzdGUiOiIiLCJ2ZXJpZnkiOiIifSwibG9naW5UaW1lIjoxNzQ0OTQyMzI2NTM0LCJzY29wZSI6WyJlbWFpbC1tYXJrZXQiLCJjb29raWUiLCJzbC1lY29tLWVtYWlsLW1hcmtldC1uZXctdGVzdCIsImVtYWlsLW1hcmtldC1uZXctZGV2LWZzIiwiYXBpLXVjLWVjMiIsImFwaS1zdS1lYzIiLCJhcGktZW0tZWMyIiwiZmxvdy1wbHVnaW4iLCJhcGktc3AtbWFya2V0LWVjMiJdLCJjbGllbnRfaWQiOiJlbWFpbC1tYXJrZXQifQ.rBrzepA8U8ghqLcNGGF4N6s6PXA6v6tJaKVOe5jQdaw; JSESSIONID=0228F95DD250A037C91E0E2927EE2FC7"
|
43
|
+
|
44
|
+
|
41
45
|
params = {
|
42
46
|
"abandonedOrderId": "c2c4a695a36373f56899b370d0f1b6f2",
|
43
47
|
"areaCode": "",
|
@@ -87,4 +91,8 @@ if __name__ == '__main__':
|
|
87
91
|
"uid": "4603296300",
|
88
92
|
"userId": "1911625831177650177"
|
89
93
|
}
|
90
|
-
mock_pulsar = MockFlow.
|
94
|
+
mock_pulsar = MockFlow.check_flow(mock_domain=_url, host_domain=host_domain, cookies=cookies,
|
95
|
+
flow_id="FLOW6749144046546626518", pulsar=params)
|
96
|
+
# node_counts, versions = MockFlow.get_current_flow(host_domain=host_domain, cookies=cookies,
|
97
|
+
# flow_id="FLOW6749144046546626518")
|
98
|
+
print(mock_pulsar)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|