smartpush 1.4.2__py3-none-any.whl → 1.4.3__py3-none-any.whl
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/flow/MockFlow.py +20 -20
- smartpush/test.py +18 -17
- {smartpush-1.4.2.dist-info → smartpush-1.4.3.dist-info}/METADATA +1 -1
- {smartpush-1.4.2.dist-info → smartpush-1.4.3.dist-info}/RECORD +6 -6
- {smartpush-1.4.2.dist-info → smartpush-1.4.3.dist-info}/WHEEL +0 -0
- {smartpush-1.4.2.dist-info → smartpush-1.4.3.dist-info}/top_level.txt +0 -0
smartpush/flow/MockFlow.py
CHANGED
@@ -25,16 +25,13 @@ def get_current_flow(host_domain, cookies, flow_id, splits=None, **kwargs):
|
|
25
25
|
get_email_content = kwargs.get("get_email_content", False)
|
26
26
|
email_contents = []
|
27
27
|
|
28
|
-
def process_node(node, split_num
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"clickUserCount": node["data"]["clickUserCount"],
|
34
|
-
"waitingCount": node["data"]["waitingCount"]
|
28
|
+
def process_node(node, split_num=0, index_type="completedCount"):
|
29
|
+
# 如当前分支为拆分节点,根据走yes还是no分支取对应字段
|
30
|
+
if "split" == node["type"] and splits is not None:
|
31
|
+
index_type = "completedCount" if splits[split_num] == "true" else "skippedCount"
|
32
|
+
node_counts.append({node["id"]: {index_type: node["data"][index_type]
|
35
33
|
}
|
36
|
-
}
|
37
|
-
)
|
34
|
+
})
|
38
35
|
# 提取邮件内容
|
39
36
|
if get_email_content and node["type"] == "sendLetter":
|
40
37
|
email_contents.append({node["data"]["sendLetter"]["emailName"]: {
|
@@ -42,11 +39,11 @@ def get_current_flow(host_domain, cookies, flow_id, splits=None, **kwargs):
|
|
42
39
|
"sender": node["data"]["sendLetter"]["sender"],
|
43
40
|
}})
|
44
41
|
# 处理split节点
|
45
|
-
if "split"
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
if "split" == node["type"] and splits is not None:
|
43
|
+
split_branch = node['data']['split']['branches'][splits[split_num]]
|
44
|
+
split_num += 1
|
45
|
+
for branch_node in split_branch:
|
46
|
+
process_node(branch_node, split_num)
|
50
47
|
# # 处理abTesting节点
|
51
48
|
# elif "abTesting" in node["data"].keys():
|
52
49
|
# for branch_node in node['data']['abTesting']['branches']["a"]:
|
@@ -107,6 +104,7 @@ def mock_pulsar(mock_domain, pulsar, limit=1):
|
|
107
104
|
"times": limit,
|
108
105
|
"mq": pulsar
|
109
106
|
}
|
107
|
+
print(params)
|
110
108
|
result = requests.request(method="post", url=_url, headers=headers, json=params).text
|
111
109
|
return json.loads(result)
|
112
110
|
|
@@ -132,6 +130,7 @@ def check_flow(host_domain, cookies, mock_domain="", **kwargs):
|
|
132
130
|
all_key: 非必填,bool,默认false,输入true时,检查指标节点常用5个字段
|
133
131
|
check_key: 非必填, 默认只有completedCount, list格式,传入需检查节点的指标key,如:completedCount、skippedCount、openRate等
|
134
132
|
split_node: list,有拆分节点时需填,结构:如: ["false", "true"],即走到拆分节点限制不满足分支再走满足分支
|
133
|
+
get_email_content: bool,默认false, 提取邮件内容,用于断言邮箱内是否送达
|
135
134
|
"""
|
136
135
|
# todo: 还差邮件校验部分,后续补充
|
137
136
|
is_split_steps = kwargs.get("split_steps", "all")
|
@@ -139,8 +138,8 @@ def check_flow(host_domain, cookies, mock_domain="", **kwargs):
|
|
139
138
|
if is_split_steps == "one" or is_split_steps == "all":
|
140
139
|
# 触发前提取flow数据,后续做对比
|
141
140
|
old_flow_counts, old_versions, _ = get_current_flow(host_domain=host_domain, cookies=cookies,
|
142
|
-
|
143
|
-
|
141
|
+
flow_id=kwargs["flow_id"],
|
142
|
+
splits=kwargs.get("split_node", None))
|
144
143
|
kwargs["old_flow_counts"] = old_flow_counts
|
145
144
|
# 更新flow
|
146
145
|
if kwargs.get("update_flow_params", False):
|
@@ -159,12 +158,13 @@ def check_flow(host_domain, cookies, mock_domain="", **kwargs):
|
|
159
158
|
time.sleep(kwargs.get("sleep_time", 60))
|
160
159
|
# 触发后提取flow数据,做断言
|
161
160
|
new_flow_counts, new_versions, email_contents = get_current_flow(host_domain=host_domain, cookies=cookies,
|
162
|
-
|
163
|
-
|
164
|
-
|
161
|
+
flow_id=kwargs["flow_id"],
|
162
|
+
splits=kwargs.get("split_node", None),
|
163
|
+
get_email_content=kwargs.get(
|
164
|
+
"get_email_content", False))
|
165
165
|
# 断言
|
166
166
|
result = ListDictUtils.compare_lists(temp1=kwargs.get("old_flow_counts"),
|
167
167
|
temp2=new_flow_counts, num=kwargs.get("num", 1),
|
168
|
-
check_key=kwargs.get("check_key", ["completedCount"]),
|
168
|
+
check_key=kwargs.get("check_key", ["completedCount", "skippedCount"]),
|
169
169
|
all_key=kwargs.get("all_key", False))
|
170
170
|
return [True, "断言成功"] if len(result) == 0 else [False, result], email_contents
|
smartpush/test.py
CHANGED
@@ -46,7 +46,7 @@ if __name__ == '__main__':
|
|
46
46
|
# flow触发流程 ------------------------------------------------------------------------------------------------------------------------
|
47
47
|
_url = "http://sp-go-flow-test.inshopline.com"
|
48
48
|
host_domain = "https://test.smartpushedm.com/api-em-ec2"
|
49
|
-
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=; osudb_oar=#01#
|
49
|
+
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=4213785247; osudb_oar=#01#SID0000128BA0RSWIkgaJoBiROHmmY9zaWt+yNT/cLZpKsGBxkFK4G4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Tc0NzczNDg0ODc0Miwic2NvcGUiOlsiZW1haWwtbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIiwiYXBpLXNwLW1hcmtldC1lYzIiXSwiY2xpZW50X2lkIjoiZW1haWwtbWFya2V0In0.O3HQgqEvqb2nxm_6EkYX797j_qqeQ21M1ohIWOJu8Uo; JSESSIONID=57D8A7D13DD34650E0FF72DDB3435515"
|
50
50
|
|
51
51
|
params = {
|
52
52
|
"abandonedOrderId": "c2c4a695a36373f56899b370d0f1b6f2",
|
@@ -146,22 +146,23 @@ if __name__ == '__main__':
|
|
146
146
|
# split_node=["true"])
|
147
147
|
# print(mock_pulsar)
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
#
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
print(
|
164
|
-
print(
|
149
|
+
old_flow_counts, old_versions, email_contents = MockFlow.get_current_flow(host_domain=host_domain, cookies=cookies,
|
150
|
+
flow_id="FLOW6966717528141252274",
|
151
|
+
splits=["false", "true", "true"],
|
152
|
+
get_email_content=True)
|
153
|
+
print(old_flow_counts, old_versions, email_contents)
|
154
|
+
# mock_pulsar_step1, _ = MockFlow.check_flow(mock_domain=_url, host_domain=host_domain, cookies=cookies,
|
155
|
+
# flow_id="FLOW6966717528141252274", pulsar=params,
|
156
|
+
# split_steps="one", split_node=["true"])
|
157
|
+
# # time.sleep(60)
|
158
|
+
# mock_pulsar_step2, email_contents = MockFlow.check_flow(mock_domain=_url, host_domain=host_domain, cookies=cookies,
|
159
|
+
# flow_id="FLOW6966717528141252274",
|
160
|
+
# old_flow_counts=mock_pulsar_step1,
|
161
|
+
# split_steps="two", split_node=["true"],
|
162
|
+
# get_email_content=True)
|
163
|
+
# print(mock_pulsar_step1)
|
164
|
+
# print(mock_pulsar_step2)
|
165
|
+
# print(email_contents)
|
165
166
|
|
166
167
|
# split_steps="two")
|
167
168
|
# # node_counts, versions = MockFlow.get_current_flow(host_domain=host_domain, cookies=cookies,
|
@@ -1,19 +1,19 @@
|
|
1
1
|
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
2
2
|
smartpush/get_jira_info.py,sha256=Ej2JRlO_Kct6Koju57b27ySy_B4q43f0I2bFcS_fmaw,17801
|
3
|
-
smartpush/test.py,sha256=
|
3
|
+
smartpush/test.py,sha256=6i68LU4QJXsW-hDU7CMFeQ5YX8GoqPO6ik8DMkxlN78,35801
|
4
4
|
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
5
5
|
smartpush/export/basic/ExcelExportChecker.py,sha256=R_1gFy69vE2V5pY20zFsnhqWgJ42Vtf35zBtOPfhUpU,17590
|
6
6
|
smartpush/export/basic/GetOssUrl.py,sha256=LeF1y1_uJaYXth1KvO6mEDS29ezb9tliBv5SrbqYkXc,6136
|
7
7
|
smartpush/export/basic/ReadExcel.py,sha256=ZnG2mtYqLY-xuYx9SyulbdYUP_0E5jIeKDewfakAsTw,7342
|
8
8
|
smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
|
9
|
-
smartpush/flow/MockFlow.py,sha256=
|
9
|
+
smartpush/flow/MockFlow.py,sha256=FE1gHq-os0o9ht167BhLY8DMzrfaDWNE4PzguQYdSIg,8068
|
10
10
|
smartpush/flow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
smartpush/utils/DataTypeUtils.py,sha256=BC7ioztO3vAfKd1EOoNvXdVuXYY8qjNskV1DP7LhW-M,1082
|
12
12
|
smartpush/utils/EmailUtlis.py,sha256=DAHd73bJ8hiJCLEXtD0xcwxPD7SOPSmBB7Jvlf6gN6s,11201
|
13
13
|
smartpush/utils/ListDictUtils.py,sha256=qXxpMwWoyaXwOHhSNUt55HtFfwmqli-wZTWmiP9qhsI,1657
|
14
14
|
smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrAo,4139
|
15
15
|
smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
smartpush-1.4.
|
17
|
-
smartpush-1.4.
|
18
|
-
smartpush-1.4.
|
19
|
-
smartpush-1.4.
|
16
|
+
smartpush-1.4.3.dist-info/METADATA,sha256=h4DUmwI-lStzgapyf6UdgLFGbXK8S5_2MRBKmpbqHtE,131
|
17
|
+
smartpush-1.4.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
18
|
+
smartpush-1.4.3.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
19
|
+
smartpush-1.4.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|