smartpush 1.9.4__py3-none-any.whl → 1.9.6__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/base/request_base.py +1 -1
- smartpush/email/schema.py +14 -0
- smartpush/email/universal_content.py +70 -12
- smartpush/utils/ListDictUtils.py +17 -1
- {smartpush-1.9.4.dist-info → smartpush-1.9.6.dist-info}/METADATA +1 -1
- {smartpush-1.9.4.dist-info → smartpush-1.9.6.dist-info}/RECORD +8 -8
- {smartpush-1.9.4.dist-info → smartpush-1.9.6.dist-info}/WHEEL +0 -0
- {smartpush-1.9.4.dist-info → smartpush-1.9.6.dist-info}/top_level.txt +0 -0
smartpush/base/request_base.py
CHANGED
|
@@ -41,7 +41,7 @@ class RequestBase:
|
|
|
41
41
|
}
|
|
42
42
|
response_json = None
|
|
43
43
|
default_kwargs.update(kwargs)
|
|
44
|
-
if default_kwargs.get('data'): # 如果data有值json序列化
|
|
44
|
+
if default_kwargs.get('data') and isinstance(default_kwargs.get('data'), dict): # 如果data有值json序列化
|
|
45
45
|
data = json.dumps(default_kwargs.get('data'))
|
|
46
46
|
default_kwargs.update({'data': data})
|
|
47
47
|
try:
|
smartpush/email/schema.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import uuid
|
|
2
3
|
from enum import unique, Enum
|
|
3
4
|
|
|
@@ -408,3 +409,16 @@ def genSection(block_list: list):
|
|
|
408
409
|
if section.value['children'][0]['type'] == 'Column':
|
|
409
410
|
section.value['children'][0]['children'] = block_list
|
|
410
411
|
return section
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
def genAllBlockSchema():
|
|
415
|
+
"""
|
|
416
|
+
获取所有的BlockSchema
|
|
417
|
+
:return:
|
|
418
|
+
"""
|
|
419
|
+
temp_list = [i.value for i in BlockSchema if i != BlockSchema.Section]
|
|
420
|
+
return temp_list
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
if __name__ == '__main__':
|
|
424
|
+
print(json.dumps(genAllBlockSchema()))
|
|
@@ -3,6 +3,7 @@ import time
|
|
|
3
3
|
from smartpush.base.request_base import RequestBase
|
|
4
4
|
from smartpush.base.url_enum import *
|
|
5
5
|
from smartpush.email.schema import *
|
|
6
|
+
from smartpush.utils import ListDictUtils
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def gen_universal_request_param(universalId, schema, **kwargs):
|
|
@@ -14,7 +15,7 @@ def gen_universal_request_param(universalId, schema, **kwargs):
|
|
|
14
15
|
universalName/subUniversal_id/type/flowModal
|
|
15
16
|
"""
|
|
16
17
|
universalName = kwargs.get('universalName', gen_universal_name(schema))
|
|
17
|
-
result_schema = get_universal_schema(schema=schema, _id=generate_UUID(
|
|
18
|
+
result_schema = get_universal_schema(schema=schema, _id=generate_UUID(9), universalId=universalId,
|
|
18
19
|
universalName=universalName)
|
|
19
20
|
requestParam = {
|
|
20
21
|
"universalId": universalId,
|
|
@@ -22,7 +23,7 @@ def gen_universal_request_param(universalId, schema, **kwargs):
|
|
|
22
23
|
"schema": json.dumps(result_schema),
|
|
23
24
|
"subUniversalId": kwargs.get('subUniversal_id', universalId),
|
|
24
25
|
"type": kwargs.get('type', 0),
|
|
25
|
-
"blockType":
|
|
26
|
+
"blockType": result_schema.get('type'),
|
|
26
27
|
"flowModal": kwargs.get('flowModal', '')
|
|
27
28
|
}
|
|
28
29
|
return json.dumps(requestParam)
|
|
@@ -77,13 +78,13 @@ class UniversalContent(RequestBase):
|
|
|
77
78
|
return result
|
|
78
79
|
|
|
79
80
|
# 删除universal
|
|
80
|
-
def delete_universal(self,
|
|
81
|
+
def delete_universal(self, universalId):
|
|
81
82
|
"""
|
|
82
83
|
删除素材
|
|
83
84
|
:param universa_id:
|
|
84
85
|
:return:
|
|
85
86
|
"""
|
|
86
|
-
requestParam = {'universalId':
|
|
87
|
+
requestParam = {'universalId': universalId}
|
|
87
88
|
result = self.request(method=URL.deleteUniversalContent.method, path=URL.deleteUniversalContent.url,
|
|
88
89
|
params=requestParam)
|
|
89
90
|
return result
|
|
@@ -101,6 +102,29 @@ class UniversalContent(RequestBase):
|
|
|
101
102
|
data=requestParam)
|
|
102
103
|
return result
|
|
103
104
|
|
|
105
|
+
def assert_block_in_the_section(self, section_universa_name, block_universa=None):
|
|
106
|
+
"""
|
|
107
|
+
判断收藏的block是否在该section中
|
|
108
|
+
:param section_universa_name:
|
|
109
|
+
:param _id:
|
|
110
|
+
:param block_universa_id:
|
|
111
|
+
:param block_universa_name:
|
|
112
|
+
:return:
|
|
113
|
+
"""
|
|
114
|
+
result = self.query_universal(universa_name=section_universa_name)
|
|
115
|
+
if result:
|
|
116
|
+
section = result['resultData']['datas'][0]
|
|
117
|
+
schema = json.loads(section['schema'])
|
|
118
|
+
if section['blockType'] == 'Section':
|
|
119
|
+
try:
|
|
120
|
+
assert block_universa == schema['children'][0]['children']
|
|
121
|
+
# if block_universa_id: # assert ListDictUtils.all_in_list(block_universa_id, #
|
|
122
|
+
# [blockUniversalId:ss['universalId'] ) elif block_universa_name: assert ListDictUtils.all_in_list(
|
|
123
|
+
# block_universa_name, [ss['universalName'] for ss in schema['children'][0]['children']]) elif _id:
|
|
124
|
+
# assert ListDictUtils.all_in_list(_id, [ss['id'] for ss in schema['children'][0]['children']])
|
|
125
|
+
print(f"------收藏的block在该section({section_universa_name})中,断言成功------")
|
|
126
|
+
except:
|
|
127
|
+
raise
|
|
104
128
|
|
|
105
129
|
|
|
106
130
|
def get_time():
|
|
@@ -108,19 +132,53 @@ def get_time():
|
|
|
108
132
|
|
|
109
133
|
|
|
110
134
|
def gen_universal_name(schema):
|
|
111
|
-
if schema.value
|
|
112
|
-
|
|
135
|
+
schema = schema if isinstance(schema, dict) else schema.value
|
|
136
|
+
if schema['type']:
|
|
137
|
+
return 'Auto-' + schema['type'] + '-' + get_time()
|
|
113
138
|
else:
|
|
114
139
|
return 'Auto-' + generate_UUID(5) + '-' + get_time()
|
|
115
140
|
|
|
116
141
|
|
|
117
142
|
def get_universal_schema(schema, _id, universalId, universalName):
|
|
118
|
-
schema
|
|
119
|
-
|
|
143
|
+
schema = schema if isinstance(schema, dict) else schema.value
|
|
144
|
+
schema.update(id=_id, universalId=universalId, universalName=universalName)
|
|
145
|
+
return schema
|
|
120
146
|
|
|
121
147
|
|
|
122
148
|
if __name__ == '__main__':
|
|
123
|
-
_list = [get_universal_schema(BlockSchema.Logo, _id=generate_UUID(9), universalId=generate_UUID(),
|
|
124
|
-
|
|
125
|
-
print(json.dumps(
|
|
126
|
-
|
|
149
|
+
# _list = [get_universal_schema(BlockSchema.Logo, _id=generate_UUID(9), universalId=generate_UUID(),
|
|
150
|
+
# universalName=gen_universal_name(BlockSchema.Logo))]
|
|
151
|
+
# print(json.dumps(_list))
|
|
152
|
+
# print(gen_universal_request_param(generate_UUID(),
|
|
153
|
+
# get_universal_schema(genSection(_list), _id=generate_UUID(9),
|
|
154
|
+
# universalId=generate_UUID(),
|
|
155
|
+
# universalName=gen_universal_name(
|
|
156
|
+
# BlockSchema.Section))))
|
|
157
|
+
sectionUniversalId = generate_UUID()
|
|
158
|
+
sectionUniversalName = gen_universal_name(BlockSchema.Section)
|
|
159
|
+
print(sectionUniversalName)
|
|
160
|
+
block_list = [BlockSchema.Logo]
|
|
161
|
+
block_dict = {}
|
|
162
|
+
result_list = []
|
|
163
|
+
blockUniversalNameList = []
|
|
164
|
+
for block in block_list:
|
|
165
|
+
name = block.name
|
|
166
|
+
block_schema = get_universal_schema(block, _id=generate_UUID(9), universalId=generate_UUID(),
|
|
167
|
+
universalName=gen_universal_name(block))
|
|
168
|
+
result_list.append(block_schema)
|
|
169
|
+
print(result_list)
|
|
170
|
+
section_schema = get_universal_schema(genSection(result_list), _id=generate_UUID(9), universalId=sectionUniversalId,
|
|
171
|
+
universalName=sectionUniversalName)
|
|
172
|
+
universal_request_param = gen_universal_request_param(sectionUniversalId, section_schema)
|
|
173
|
+
print(universal_request_param)
|
|
174
|
+
head = {
|
|
175
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uZGxlIjoic21hcnRwdXNoNCIsImVudiI6IkNOIiwic3RlIjoiIiwidmVyaWZ5IjoiIn0sImxvZ2luVGltZSI6MTc2MzAwNjQ3NDQzNywic2NvcGUiOlsiZW1haWwtbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIiwiYXBpLXNwLW1hcmtldC1lYzIiXSwiY2xpZW50X2lkIjoiZW1haWwtbWFya2V0In0.erTiG4r364sutySNgx8X1rmrAjFsyfoe3UIUZ6J9e-o;",
|
|
176
|
+
"Content-Type": "application/json", "accept-language": "zh-CN"}
|
|
177
|
+
universal = UniversalContent(headers=head, host='https://test.smartpushedm.com/bff/api-sp-market-ec2')
|
|
178
|
+
try:
|
|
179
|
+
universal.create_universal(requestParam=universal_request_param)
|
|
180
|
+
universal.assert_block_in_the_section(sectionUniversalName, result_list)
|
|
181
|
+
except:
|
|
182
|
+
raise
|
|
183
|
+
finally:
|
|
184
|
+
universal.delete_universal(sectionUniversalId)
|
smartpush/utils/ListDictUtils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
|
-
from deepdiff import DeepDiff
|
|
3
|
+
# from deepdiff import DeepDiff
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def compare_lists(temp1, temp2, check_key=["completedCount"], all_key=False, num=1):
|
|
@@ -54,3 +54,19 @@ def json_to_dict(json_data=None):
|
|
|
54
54
|
with open("/Users/SL/project/python/smartpush_autotest/smartpush/test.json", "r", encoding="utf-8") as file:
|
|
55
55
|
json_result = json.load(file)
|
|
56
56
|
return json_result
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def all_in_list(list_a, list_b):
|
|
60
|
+
"""
|
|
61
|
+
判断元素是否都在list_b中
|
|
62
|
+
:param list_a:
|
|
63
|
+
:param list_b:
|
|
64
|
+
:return:
|
|
65
|
+
"""
|
|
66
|
+
if isinstance(list_a, str):
|
|
67
|
+
print(f"判断字符串【{list_a}】在 {list_b}")
|
|
68
|
+
return list_a in list_b
|
|
69
|
+
else:
|
|
70
|
+
# 支持列表、元组、集合等可迭代类型
|
|
71
|
+
print(f"判断对象【{list_a}】在 {list_b}")
|
|
72
|
+
return set(list_a).issubset(set(list_b))
|
|
@@ -4,13 +4,13 @@ smartpush/account/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
4
4
|
smartpush/account/operate_account.py,sha256=nzJLLAEwNElavZeWVqnA_MSGTBzQrSrknmezYBwtvWs,1525
|
|
5
5
|
smartpush/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
smartpush/base/faker_data.py,sha256=TOd5EKVImxZpsKEW_dtKa2iqiUGqU7OBkOM8pvqKVUc,24643
|
|
7
|
-
smartpush/base/request_base.py,sha256=
|
|
7
|
+
smartpush/base/request_base.py,sha256=mg0dSm6ucPdwqSUn_tQzynYWYKf0_vX7kcGJWSsX3e0,2455
|
|
8
8
|
smartpush/base/url_enum.py,sha256=GC8lXuXflKFl3xbeOIzS3vgE7BF2Zo5H9pn6okgHPyQ,1627
|
|
9
9
|
smartpush/crowd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
smartpush/crowd/crowd.py,sha256=8z5FIWCiTeSUQJGWbLLjS_2AsPbVOsW0GrSZKnYtgng,20985
|
|
11
11
|
smartpush/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
smartpush/email/schema.py,sha256=
|
|
13
|
-
smartpush/email/universal_content.py,sha256=
|
|
12
|
+
smartpush/email/schema.py,sha256=Gf9tYNP9UjkbXpPbh_uAcAx7QZ5RNs-E7GPVp1BU9d8,23478
|
|
13
|
+
smartpush/email/universal_content.py,sha256=By8ZzhPEvTYuktPfh_wRwRSYnntwoV5qJd3mXzkrSg4,9063
|
|
14
14
|
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
|
15
15
|
smartpush/export/basic/ExcelExportChecker.py,sha256=YqWmDGSFadQdK2vNJ070Qvad9ZtqEwiQyPkOemlACfs,21508
|
|
16
16
|
smartpush/export/basic/GetOssUrl.py,sha256=zxNZj6x7Ph9N3P5k82pLpBFjZxKrDfbgqS2fTYyhvso,8467
|
|
@@ -27,11 +27,11 @@ smartpush/form/form_before.py,sha256=CCvAC_2yWPlnQGtjEA8LPLy9853Nq3nNjcL2GewFWIs
|
|
|
27
27
|
smartpush/form/form_client_operation.py,sha256=gg-5uHXCyMa_ypBSYPYFVxXdwZdYBJsNtUCqayknMBw,303
|
|
28
28
|
smartpush/utils/DataTypeUtils.py,sha256=BC7ioztO3vAfKd1EOoNvXdVuXYY8qjNskV1DP7LhW-M,1082
|
|
29
29
|
smartpush/utils/EmailUtlis.py,sha256=DAHd73bJ8hiJCLEXtD0xcwxPD7SOPSmBB7Jvlf6gN6s,11201
|
|
30
|
-
smartpush/utils/ListDictUtils.py,sha256=
|
|
30
|
+
smartpush/utils/ListDictUtils.py,sha256=cLaZSQD-MrwZLdotyHMY6vdEF-HNNsbSv87YFRWyt04,2826
|
|
31
31
|
smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrAo,4139
|
|
32
32
|
smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
smartpush/utils/form_utils.py,sha256=ld-g_Dm_ZlnagQt7imYfUc87bcBRVlTctywuLtzmjXQ,849
|
|
34
|
-
smartpush-1.9.
|
|
35
|
-
smartpush-1.9.
|
|
36
|
-
smartpush-1.9.
|
|
37
|
-
smartpush-1.9.
|
|
34
|
+
smartpush-1.9.6.dist-info/METADATA,sha256=3IJzh7R4m2M9oI2nzR4winfDMSA4QTZgEflASPnIxjU,131
|
|
35
|
+
smartpush-1.9.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
36
|
+
smartpush-1.9.6.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
|
37
|
+
smartpush-1.9.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|