smartpush 1.9.4__py3-none-any.whl → 1.9.5__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/email/schema.py +14 -0
- smartpush/email/universal_content.py +45 -6
- smartpush/utils/ListDictUtils.py +16 -0
- {smartpush-1.9.4.dist-info → smartpush-1.9.5.dist-info}/METADATA +1 -1
- {smartpush-1.9.4.dist-info → smartpush-1.9.5.dist-info}/RECORD +7 -7
- {smartpush-1.9.4.dist-info → smartpush-1.9.5.dist-info}/WHEEL +0 -0
- {smartpush-1.9.4.dist-info → smartpush-1.9.5.dist-info}/top_level.txt +0 -0
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):
|
|
@@ -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,37 @@ 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_id=None, block_universa_name=None,
|
|
106
|
+
_id=None, ):
|
|
107
|
+
"""
|
|
108
|
+
判断收藏的block是否在该section中
|
|
109
|
+
:param section_universa_name:
|
|
110
|
+
:param _id:
|
|
111
|
+
:param block_universa_id:
|
|
112
|
+
:param block_universa_name:
|
|
113
|
+
:return:
|
|
114
|
+
"""
|
|
115
|
+
result = self.query_universal(universa_name=section_universa_name)
|
|
116
|
+
schema = {}
|
|
117
|
+
section = None
|
|
118
|
+
if result:
|
|
119
|
+
section = result['resultData']['datas'][0]
|
|
120
|
+
schema = json.loads(section['schema'])
|
|
121
|
+
if section['blockType'] == 'Section':
|
|
122
|
+
try:
|
|
123
|
+
if block_universa_id:
|
|
124
|
+
assert ListDictUtils.all_in_list(block_universa_id, [ss['universalId'] for ss in schema['children'][0]['children']])
|
|
125
|
+
elif block_universa_name:
|
|
126
|
+
assert ListDictUtils.all_in_list(block_universa_name, [ss['universalName'] for ss in schema['children'][0]['children']])
|
|
127
|
+
elif _id:
|
|
128
|
+
assert ListDictUtils.all_in_list(_id, [ss['id'] for ss in schema['children'][0]['children']])
|
|
129
|
+
print("------收藏的block在该section中,断言成功------")
|
|
130
|
+
except:
|
|
131
|
+
raise
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
104
136
|
|
|
105
137
|
|
|
106
138
|
def get_time():
|
|
@@ -120,7 +152,14 @@ def get_universal_schema(schema, _id, universalId, universalName):
|
|
|
120
152
|
|
|
121
153
|
|
|
122
154
|
if __name__ == '__main__':
|
|
123
|
-
_list = [get_universal_schema(BlockSchema.Logo, _id=generate_UUID(9), universalId=generate_UUID(),
|
|
124
|
-
|
|
125
|
-
print(json.dumps(get_universal_schema(genSection(_list), _id=generate_UUID(9), universalId=generate_UUID(),
|
|
126
|
-
|
|
155
|
+
# _list = [get_universal_schema(BlockSchema.Logo, _id=generate_UUID(9), universalId=generate_UUID(),
|
|
156
|
+
# universalName=gen_universal_name(BlockSchema.Logo))]
|
|
157
|
+
# print(json.dumps(get_universal_schema(genSection(_list), _id=generate_UUID(9), universalId=generate_UUID(),
|
|
158
|
+
# universalName=gen_universal_name(BlockSchema.Section))))
|
|
159
|
+
|
|
160
|
+
head = {
|
|
161
|
+
"cookie": "osudb_appid=SMARTPUSH;osudb_oar=#01#SID0000141BOhqtUqYGMjRho2SIPBeE5o1HNWFHo9q+qttt/jMLf+gRshde7x0NZUgAST4PB4CfSuAa450BCuCZf6pwolP1vXs/cF+6e/snBhESLvofXaxDaIFN9swZq4Np2xBc4uw6R4V58uWjrwg+s8XTLVv;osudb_subappid=1;osudb_uid=4213785247;ecom_http_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjU1OTg0NzQsImp0aSI6ImU0YzAyZjcxLWQ4NDktNDZlYS1iNzNmLTY1YjU0YTc3MTJjZCIsInVzZXJJbmZvIjp7ImlkIjowLCJ1c2VySWQiOiI0MjEzNzg1MjQ3IiwidXNlcm5hbWUiOiIiLCJlbWFpbCI6ImZlbGl4LnNoYW9Ac2hvcGxpbmVhcHAuY29tIiwidXNlclJvbGUiOiJvd25lciIsInBsYXRmb3JtVHlwZSI6Nywic3ViUGxhdGZvcm0iOjEsInBob25lIjoiIiwibGFuZ3VhZ2UiOiJ6aC1oYW5zLWNuIiwiYXV0aFR5cGUiOiIiLCJhdHRyaWJ1dGVzIjp7ImNvdW50cnlDb2RlIjoiQ04iLCJjdXJyZW5jeSI6IkpQWSIsImN1cnJlbmN5U3ltYm9sIjoiSlDCpSIsImRvbWFpbiI6InNtYXJ0cHVzaDQubXlzaG9wbGluZXN0Zy5jb20iLCJsYW5ndWFnZSI6ImVuIiwibWVyY2hhbnRFbWFpbCI6ImZlbGl4LnNoYW9Ac2hvcGxpbmUuY29tIiwibWVyY2hhbnROYW1lIjoiU21hcnRQdXNoNF9lYzJf6Ieq5Yqo5YyW5bqX6ZO6IiwicGhvbmUiOiIiLCJzY29wZUNoYW5nZWQiOmZhbHNlLCJzdGFmZkxhbmd1YWdlIjoiemgtaGFucy1jbiIsInN0YXR1cyI6MCwidGltZXpvbmUiOiJBc2lhL01hY2FvIn0sInN0b3JlSWQiOiIxNjQ0Mzk1OTIwNDQ0IiwiaGFuZGxlIjoic21hcnRwdXNoNCIsImVudiI6IkNOIiwic3RlIjoiIiwidmVyaWZ5IjoiIn0sImxvZ2luVGltZSI6MTc2MzAwNjQ3NDQzNywic2NvcGUiOlsiZW1haWwtbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIiwiYXBpLXNwLW1hcmtldC1lYzIiXSwiY2xpZW50X2lkIjoiZW1haWwtbWFya2V0In0.erTiG4r364sutySNgx8X1rmrAjFsyfoe3UIUZ6J9e-o;",
|
|
162
|
+
"Content-Type": "application/json", "accept-language": "zh-CN"}
|
|
163
|
+
|
|
164
|
+
UniversalContent(headers=head, host='https://test.smartpushedm.com/bff/api-sp-market-ec2') \
|
|
165
|
+
.assert_block_in_the_section('Section23452345234', block_universa_name=['5555345243'])
|
smartpush/utils/ListDictUtils.py
CHANGED
|
@@ -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
|
+
def all_in_list(list_a, list_b):
|
|
59
|
+
|
|
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))
|
|
@@ -9,8 +9,8 @@ smartpush/base/url_enum.py,sha256=GC8lXuXflKFl3xbeOIzS3vgE7BF2Zo5H9pn6okgHPyQ,16
|
|
|
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=MPGrquHFpxFaX6g8LNfwNxaQvJkvhsbzPU20IJfHRB0,7676
|
|
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=LEQG9J9q7st5GHbM8rpDz5mlPbSWU8fOQMPcIKEAmXg,2812
|
|
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.5.dist-info/METADATA,sha256=xJ4SYQzXuTsLr1FXC8NS-A_FgsER1PRafbxdz5tUU5I,131
|
|
35
|
+
smartpush-1.9.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
36
|
+
smartpush-1.9.5.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
|
37
|
+
smartpush-1.9.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|