smartpush 1.9.2__py3-none-any.whl → 1.9.4__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/crowd/crowd.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import json
2
+ import time
2
3
 
3
4
  from smartpush.base.request_base import CrowdRequestBase, RequestBase
4
5
  from smartpush.base.url_enum import URL
@@ -55,6 +56,28 @@ class Crowd(CrowdRequestBase):
55
56
  resultData = result['resultData']
56
57
  return resultData
57
58
 
59
+ def check_crowd(self, expected_rule, expected_ids, sleep=5):
60
+ """校验群组结果"""
61
+ result = {}
62
+ # 校验群组详情条件
63
+ crowd_detail = self.callCrowdPackageDetail()
64
+ if crowd_detail["resultData"]["groupRules"] == expected_rule:
65
+ result["rule"] = True
66
+ else:
67
+ result["rule"] = {"条件断言": False, "实际条件": crowd_detail["resultData"]["groupRules"]}
68
+ # 校验群组筛选人群
69
+ time.sleep(sleep)
70
+ crowd_persons = self.callCrowdPersonListInPackage()
71
+ crowd_person_uids = [person["uid"] for person in crowd_persons]
72
+ not_in_uid = expected_ids - crowd_person_uids
73
+ if not_in_uid:
74
+ result["uid"] = {"人群断言": False, "未匹配到的uid": not_in_uid}
75
+ else:
76
+ result["uid"] = True
77
+
78
+ return result
79
+
80
+
58
81
 
59
82
  class CrowdList(RequestBase):
60
83
  def callCrowdPackageList(self, page=1, pageSize=20):
smartpush/email/schema.py CHANGED
@@ -1,21 +1,28 @@
1
1
  import uuid
2
- import time
3
2
  from enum import unique, Enum
4
3
 
5
4
 
5
+ def generate_UUID(length=None):
6
+ _uuid = str(uuid.uuid4())
7
+ if length:
8
+ return _uuid.replace('-', '')[:length]
9
+ else:
10
+ return _uuid
11
+
12
+
6
13
  @unique
7
14
  class BlockSchema(Enum):
8
15
  Logo = {
9
- "id": "81886ba38",
10
- "universalId": "8ff4fe49-c36f-426c-9f8c-d06e1a4877c3",
11
- "universalName": "block",
16
+ "id": generate_UUID(9),
17
+ "universalId": None,
18
+ "universalName": None,
12
19
  "type": "Logo",
13
20
  "props": {
14
21
  "width": "120",
15
22
  "height": "120",
16
23
  "imgRatio": 1,
17
24
  "src": "https://cdn.smartpushedm.com/frontend/smart-push/staging/1741054956275/1758595834300_74d62ae6.png?width=120&height=120",
18
- "href": "https://lulu373.myshoplinestg.com",
25
+ "href": "https://smartpush4.myshoplinestg.com",
19
26
  "align": "center",
20
27
  "containerBackgroundColor": "transparent",
21
28
  "paddingLeft": "20px",
@@ -29,9 +36,9 @@ class BlockSchema(Enum):
29
36
  "children": []
30
37
  }
31
38
  Link = {
32
- "id": "b78bcb99a",
33
- "universalId": "c3db1401-ddae-4222-8ec3-b5dd9e6b16f3",
34
- "universalName": "block",
39
+ "id": generate_UUID(9),
40
+ "universalId": None,
41
+ "universalName": None,
35
42
  "type": "Navigation",
36
43
  "props": {
37
44
  "moduleList": [
@@ -69,9 +76,9 @@ class BlockSchema(Enum):
69
76
  "children": []
70
77
  }
71
78
  Image = {
72
- "id": "a499b9a69",
73
- "universalId": "a3d8c5f1-3384-492c-8984-81e424892357",
74
- "universalName": "img",
79
+ "id": generate_UUID(9),
80
+ "universalId": None,
81
+ "universalName": None,
75
82
  "type": "Image",
76
83
  "props": {
77
84
  "width": "600px",
@@ -89,9 +96,9 @@ class BlockSchema(Enum):
89
96
  "children": []
90
97
  }
91
98
  ImageSet = {
92
- "id": "a59b8ba3b",
93
- "universalId": "0980b7a8-188e-4afb-b829-e3d93bb78347",
94
- "universalName": "block",
99
+ "id": generate_UUID(9),
100
+ "universalId": None,
101
+ "universalName": None,
95
102
  "type": "ImageSet",
96
103
  "props": {
97
104
  "list": [
@@ -134,7 +141,9 @@ class BlockSchema(Enum):
134
141
  },
135
142
  "children": []
136
143
  }
137
- Video = {"id": "939b5b82b", "universalId": "11bdb29c-1b68-4346-b8a8-87c3fd806291", "universalName": "block",
144
+ Video = {"id": generate_UUID(9),
145
+ "universalId": None,
146
+ "universalName": None,
138
147
  "type": "Video",
139
148
  "props": {"iconColor": "#ffffff", "iconStyle": 1, "videoImageType": "auto", "videoHref": "",
140
149
  "width": "600px",
@@ -143,8 +152,9 @@ class BlockSchema(Enum):
143
152
  "containerBackgroundColor": "transparent", "paddingLeft": "10px", "paddingRight": "10px",
144
153
  "paddingTop": "10px", "paddingBottom": "10px", "paddingCondition": True
145
154
  }, "children": []}
146
- TimerCountdown = {"id": "92a88aa98", "universalId": "e5ff3684-977b-4934-8c6b-148aa76214fe",
147
- "universalName": "block",
155
+ TimerCountdown = {"id": generate_UUID(9),
156
+ "universalId": None,
157
+ "universalName": None,
148
158
  "type": "TimerCountdown",
149
159
  "props": {"gifColor": "#FA7124", "gifLoading": False, "selected": False, "day": 2, "hour": 0,
150
160
  "minute": 0, "width": "600px", "height": "156px",
@@ -159,7 +169,9 @@ class BlockSchema(Enum):
159
169
  ,
160
170
  "containerBackgroundColor": "transparent", "gifId": "246f5df56e674676add060956fac7b3f"},
161
171
  "children": []}
162
- Commodity = {"id": "8d9a48a69", "universalId": "784daa8e-a474-42d9-a514-ab6509aec569", "universalName": "block",
172
+ Commodity = {"id": generate_UUID(9),
173
+ "universalId": None,
174
+ "universalName": None,
163
175
  "type": "Commodity",
164
176
  "props": {"source": None, "limit": 6, "justifyContent": "center", "imgRatio": "3:4",
165
177
  "imgFillType": "cover", "isProductTitle": True
@@ -186,7 +198,9 @@ class BlockSchema(Enum):
186
198
  "currency": 1, "currencyFormat": True
187
199
  , "currencyDecimalPoint": 2,
188
200
  "segmentTypeConfig": 1}, "children": []}
189
- Discount = {"id": "979a29818", "universalId": "69130914-e7f9-4b3b-b5de-aef5891cb55d", "universalName": "block",
201
+ Discount = {"id": generate_UUID(9),
202
+ "universalId": None,
203
+ "universalName": None,
190
204
  "type": "Discount",
191
205
  "props": {"discountTermsFontFamily_SHOPIFY": "arial,helvetica,sans-serif,Arial, Helvetica, sans-serif",
192
206
  "discountTermsFontFamily_EC1": "arial,helvetica,sans-serif,Arial, Helvetica, sans-serif",
@@ -269,7 +283,9 @@ class BlockSchema(Enum):
269
283
  "btnText_CUSTOM": "Use discount now", "btnText_EC1": "Use discount now", "btnUrl_EC2": "",
270
284
  "btnUrl_SHOPIFY": "", "btnUrl_CUSTOM": "", "btnUrl_EC1": "", "isShowPreviewForm": False},
271
285
  "children": []}
272
- TextSet = {"id": "908928b6b", "universalId": "d857d68f-3565-4d78-8a4b-dd56e133043e", "universalName": "block",
286
+ TextSet = {"id": generate_UUID(9),
287
+ "universalId": None,
288
+ "universalName": None,
273
289
  "type": "TextSet", "props": {"list": [{
274
290
  "content": "<p style=\"font-family: arial,helvetica,sans-serif,Arial, Helvetica, sans-serif\">在此处输入文本,支持按需调整字体大小、行距、对齐方式等样式</p>",
275
291
  "paddingLeft": "10px", "paddingRight": "10px", "paddingTop": "0px",
@@ -279,7 +295,9 @@ class BlockSchema(Enum):
279
295
  "paddingRight": "10px", "paddingTop": "10px", "paddingBottom": "10px",
280
296
  "paddingCondition": True
281
297
  }, "children": []}
282
- ImageText = {"id": "a499ea949", "universalId": "41f04a27-8230-42d1-bd05-16c2444e7b37", "universalName": "block",
298
+ ImageText = {"id": generate_UUID(9),
299
+ "universalId": None,
300
+ "universalName": None,
283
301
  "type": "ImageText", "props": {"list": [{"src": "", "width": "290", "height": "150", "imgRatio": 0.51,
284
302
  "content": "<p style=\"font-family: arial,helvetica,sans-serif,Arial, Helvetica, sans-serif\">在此处输入文本,支持按需调整字体大小、行距、对齐方式等样式</p>",
285
303
  "layout": "rightText", "borderWidth": "1px",
@@ -289,7 +307,9 @@ class BlockSchema(Enum):
289
307
  "paddingRight": "10px", "paddingTop": "10px", "paddingBottom": "10px",
290
308
  "paddingCondition": True
291
309
  , "layoutItem": "rightText", "segmentTypeConfig": 1}, "children": []}
292
- Button = {"id": "bea9bb83b", "universalId": "cb3a47a7-2db5-46c3-af57-3eb134fabb98", "universalName": "block",
310
+ Button = {"id": generate_UUID(9),
311
+ "universalId": None,
312
+ "universalName": None,
293
313
  "type": "Button",
294
314
  "props": {"content": "Button", "color": "#ffffff", "fontSize": "18px", "fontWeight": 500,
295
315
  "fontFamily": "arial,helvetica,sans-serif,Arial, Helvetica, sans-serif",
@@ -300,22 +320,91 @@ class BlockSchema(Enum):
300
320
  "paddingRight": "10px", "paddingTop": "10px", "paddingBottom": "10px",
301
321
  "paddingCondition": True
302
322
  }, "children": []}
303
- Divider = {"id": "b2897b90a", "universalId": "2ebe35a0-521a-4b8a-aee0-2c035618333f", "universalName": "block",
323
+ Divider = {"id": generate_UUID(9),
324
+ "universalId": None,
325
+ "universalName": None,
304
326
  "type": "Divider",
305
327
  "props": {"borderColor": "#000000", "borderStyle": "solid", "borderWidth": "1px", "paddingLeft": "20px",
306
328
  "paddingRight": "20px", "paddingTop": "20px", "paddingBottom": "20px", "paddingCondition": True
307
329
  }, "children": []}
308
- Social = {"id": "9b8b19879", "universalId": "138ccb97-3c62-4119-9490-1a251808c5c3", "universalName": "block",
330
+ Social = {"id": generate_UUID(9),
331
+ "universalId": None,
332
+ "universalName": None,
309
333
  "type": "Social", "props": {
310
334
  "list": [{"name": "facebook-noshare", "iconSize": "36px", "src": "", "iconStyle": 1, "href": ""},
311
335
  {"name": "instagram", "iconSize": "36px", "src": "", "iconStyle": 1, "href": ""},
312
336
  {"name": "web", "iconSize": "36px", "src": "", "iconStyle": 1, "href": ""}],
313
337
  "containerBackgroundColor": "transparent", "iconStyle": 1}, "children": []}
314
- HTMLCode = {"id": "838a79a4a", "universalId": "14baf9dc-764f-43a4-8cba-e72eac5ce5d5", "universalName": "block",
338
+ HTMLCode = {"id": generate_UUID(9),
339
+ "universalId": None,
340
+ "universalName": None,
315
341
  "type": "HTMLCode", "props": {"list": [
316
342
  {"content": "使用你自定义的代码段", "paddingLeft": "0px", "paddingRight": "0px", "paddingTop": "0px",
317
343
  "paddingBottom": "0px", "borderStyle": "none", "borderColor": "#ffffff", "borderWidth": "1px"}],
318
344
  "containerBackgroundColor": "TRANSPARENT", "paddingLeft": "0px",
319
345
  "paddingRight": "0px", "paddingTop": "0px", "paddingBottom": "0px",
320
346
  "paddingCondition": True
321
- }, "children": []}
347
+ }, "children": []}
348
+ Section = {
349
+ "id": generate_UUID(9),
350
+ "universalId": None,
351
+ "universalName": None,
352
+ "type": "Section",
353
+ "props": {
354
+ "backgroundColor": "#f1e6e6",
355
+ "borderLeft": "1px none #ffffff",
356
+ "borderRight": "1px none #ffffff",
357
+ "borderTop": "1px none #ffffff",
358
+ "borderBottom": "1px none #ffffff",
359
+ "paddingTop": "0px",
360
+ "paddingBottom": "0px",
361
+ "paddingLeft": "0px",
362
+ "paddingRight": "0px",
363
+ "cols": [
364
+ 12
365
+ ]
366
+ },
367
+ "children": [
368
+ {
369
+ "id": "8cab9aa48",
370
+ "type": "Column",
371
+ "props": {},
372
+ "children": [
373
+ {
374
+ "id": "a398fa9db",
375
+ "universalId": "3a8b79e8-b400-43d4-8d4c-c70969284a24",
376
+ "universalName": "Auto-Logo-2025-11-14 00:33:28",
377
+ "type": "Logo",
378
+ "props": {
379
+ "width": "120",
380
+ "height": "120",
381
+ "imgRatio": 1,
382
+ "src": "https://cdn.smartpushedm.com/frontend/smart-push/staging/1741054956275/1758595834300_74d62ae6.png?width=120&height=120",
383
+ "href": "https://smartpush4.myshoplinestg.com",
384
+ "align": "center",
385
+ "containerBackgroundColor": "transparent",
386
+ "paddingLeft": "20px",
387
+ "paddingRight": "20px",
388
+ "paddingTop": "20px",
389
+ "paddingBottom": "20px",
390
+ "paddingCondition": True,
391
+ "segmentTypeConfig": 1
392
+ },
393
+ "children": []
394
+ }
395
+ ]
396
+ }
397
+ ]
398
+ }
399
+
400
+
401
+ def genSection(block_list: list):
402
+ """
403
+ 根据Block生成Section结构体
404
+ :param block_list:
405
+ :return:
406
+ """
407
+ section = BlockSchema.Section
408
+ if section.value['children'][0]['type'] == 'Column':
409
+ section.value['children'][0]['children'] = block_list
410
+ return section
@@ -1,5 +1,5 @@
1
1
  import json
2
-
2
+ 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 *
@@ -38,14 +38,14 @@ class UniversalContent(RequestBase):
38
38
  return result
39
39
 
40
40
  # 查询universal
41
- def query_universal(self, universa_name='', blockType_list=None):
41
+ def query_universal(self, universa_name='', blockType_list=[]):
42
42
  """
43
43
  查询素材
44
44
  :param blockType_list:
45
45
  :param universa_name:
46
46
  :return:
47
47
  """
48
- requestParam = {'universa_name': universa_name}
48
+ requestParam = {'universalName': universa_name}
49
49
  if blockType_list and type(blockType_list) == list:
50
50
  requestParam.update(blockType=blockType_list)
51
51
  result = self.request(method=URL.queryUniversalContent.method, path=URL.queryUniversalContent.url,
@@ -102,13 +102,6 @@ class UniversalContent(RequestBase):
102
102
  return result
103
103
 
104
104
 
105
- def generate_UUID(length=None):
106
- _uuid = str(uuid.uuid4())
107
- if length:
108
- return _uuid[:length]
109
- else:
110
- return _uuid
111
-
112
105
 
113
106
  def get_time():
114
107
  return str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
@@ -127,4 +120,7 @@ def get_universal_schema(schema, _id, universalId, universalName):
127
120
 
128
121
 
129
122
  if __name__ == '__main__':
130
- print(gen_universal_request_param(generate_UUID(), BlockSchema.Social, ))
123
+ _list = [get_universal_schema(BlockSchema.Logo, _id=generate_UUID(9), universalId=generate_UUID(),
124
+ universalName=gen_universal_name(BlockSchema.Logo))]
125
+ print(json.dumps(get_universal_schema(genSection(_list), _id=generate_UUID(9), universalId=generate_UUID(),
126
+ universalName=gen_universal_name(BlockSchema.Section))))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.9.2
3
+ Version: 1.9.4
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: lulu、felix、long
6
6
 
@@ -1,6 +1,5 @@
1
1
  smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
2
2
  smartpush/get_jira_info.py,sha256=s3hPwC6KePS5BtqNS9o15eCh7Nx2gn16bn6tfYK0iQI,18112
3
- smartpush/test.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
3
  smartpush/account/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
4
  smartpush/account/operate_account.py,sha256=nzJLLAEwNElavZeWVqnA_MSGTBzQrSrknmezYBwtvWs,1525
6
5
  smartpush/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,10 +7,10 @@ smartpush/base/faker_data.py,sha256=TOd5EKVImxZpsKEW_dtKa2iqiUGqU7OBkOM8pvqKVUc,
8
7
  smartpush/base/request_base.py,sha256=7R-aJyMKJ7d50bbyi-2tCUuqR9JfHsZIU-jGhbSVaSU,2406
9
8
  smartpush/base/url_enum.py,sha256=GC8lXuXflKFl3xbeOIzS3vgE7BF2Zo5H9pn6okgHPyQ,1627
10
9
  smartpush/crowd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- smartpush/crowd/crowd.py,sha256=XAOdvtgUVRMMQOor2bRPdTK2aYqlA_Zo7HapqsBANcE,20110
10
+ smartpush/crowd/crowd.py,sha256=8z5FIWCiTeSUQJGWbLLjS_2AsPbVOsW0GrSZKnYtgng,20985
12
11
  smartpush/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- smartpush/email/schema.py,sha256=hWFAuYFM2O55Wfds8xm750cXDr5gr2QnIawma2FIfyE,20925
14
- smartpush/email/universal_content.py,sha256=GXaCEutCee3GoVCVzLznuGxSXU7-MI1QMj7SRstfXyU,4323
12
+ smartpush/email/schema.py,sha256=SHRETmm2pe79YTo82aFFM9JPbuUEBRSUsCXODikimDg,23211
13
+ smartpush/email/universal_content.py,sha256=XpCMs_frppmog8OAY1rAht0iXzr8ICjQsXV8Lq_kFYM,4505
15
14
  smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
16
15
  smartpush/export/basic/ExcelExportChecker.py,sha256=YqWmDGSFadQdK2vNJ070Qvad9ZtqEwiQyPkOemlACfs,21508
17
16
  smartpush/export/basic/GetOssUrl.py,sha256=zxNZj6x7Ph9N3P5k82pLpBFjZxKrDfbgqS2fTYyhvso,8467
@@ -32,7 +31,7 @@ smartpush/utils/ListDictUtils.py,sha256=62GDkG5VrWoxahIDTnzAHr6zz8r5ebrRmnjU3YZa
32
31
  smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrAo,4139
33
32
  smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
33
  smartpush/utils/form_utils.py,sha256=ld-g_Dm_ZlnagQt7imYfUc87bcBRVlTctywuLtzmjXQ,849
35
- smartpush-1.9.2.dist-info/METADATA,sha256=K5olHFNjdGMo1rmeSEhJExgwqXe0pFAfTA9RoQYPEjM,131
36
- smartpush-1.9.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
37
- smartpush-1.9.2.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
38
- smartpush-1.9.2.dist-info/RECORD,,
34
+ smartpush-1.9.4.dist-info/METADATA,sha256=g7Cao4EdEdlklwrGuHtV8yExVx5Z3ECa9b4ey_DJ_js,131
35
+ smartpush-1.9.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
36
+ smartpush-1.9.4.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
37
+ smartpush-1.9.4.dist-info/RECORD,,
smartpush/test.py DELETED
File without changes