smartpush 1.9.5__py3-none-any.whl → 1.9.7__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.
@@ -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:
@@ -15,7 +15,7 @@ def gen_universal_request_param(universalId, schema, **kwargs):
15
15
  universalName/subUniversal_id/type/flowModal
16
16
  """
17
17
  universalName = kwargs.get('universalName', gen_universal_name(schema))
18
- result_schema = get_universal_schema(schema=schema, _id=generate_UUID(8), universalId=universalId,
18
+ result_schema = get_universal_schema(schema=schema, _id=generate_UUID(9), universalId=universalId,
19
19
  universalName=universalName)
20
20
  requestParam = {
21
21
  "universalId": universalId,
@@ -23,7 +23,7 @@ def gen_universal_request_param(universalId, schema, **kwargs):
23
23
  "schema": json.dumps(result_schema),
24
24
  "subUniversalId": kwargs.get('subUniversal_id', universalId),
25
25
  "type": kwargs.get('type', 0),
26
- "blockType": schema.name,
26
+ "blockType": result_schema.get('type'),
27
27
  "flowModal": kwargs.get('flowModal', '')
28
28
  }
29
29
  return json.dumps(requestParam)
@@ -102,8 +102,7 @@ class UniversalContent(RequestBase):
102
102
  data=requestParam)
103
103
  return result
104
104
 
105
- def assert_block_in_the_section(self, section_universa_name, block_universa_id=None, block_universa_name=None,
106
- _id=None, ):
105
+ def assert_block_in_the_section(self, section_universa_name, block_universa=None):
107
106
  """
108
107
  判断收藏的block是否在该section中
109
108
  :param section_universa_name:
@@ -113,53 +112,73 @@ class UniversalContent(RequestBase):
113
112
  :return:
114
113
  """
115
114
  result = self.query_universal(universa_name=section_universa_name)
116
- schema = {}
117
- section = None
118
115
  if result:
119
116
  section = result['resultData']['datas'][0]
120
117
  schema = json.loads(section['schema'])
121
118
  if section['blockType'] == 'Section':
122
119
  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中,断言成功------")
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})中,断言成功------")
130
126
  except:
131
127
  raise
132
128
 
133
129
 
134
-
135
-
136
-
137
-
138
130
  def get_time():
139
131
  return str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
140
132
 
141
133
 
142
134
  def gen_universal_name(schema):
143
- if schema.value['type']:
144
- return 'Auto-' + schema.value['type'] + '-' + get_time()
135
+ schema = schema if isinstance(schema, dict) else schema.value
136
+ if schema['type']:
137
+ return 'Auto-' + schema['type'] + '-' + get_time()
145
138
  else:
146
139
  return 'Auto-' + generate_UUID(5) + '-' + get_time()
147
140
 
148
141
 
149
142
  def get_universal_schema(schema, _id, universalId, universalName):
150
- schema.value.update(id=_id, universalId=universalId, universalName=universalName)
151
- return schema.value
143
+ schema = schema if isinstance(schema, dict) else schema.value
144
+ schema.update(id=_id, universalId=universalId, universalName=universalName)
145
+ return schema
152
146
 
153
147
 
154
148
  if __name__ == '__main__':
155
149
  # _list = [get_universal_schema(BlockSchema.Logo, _id=generate_UUID(9), universalId=generate_UUID(),
156
150
  # 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
-
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)
160
174
  head = {
161
175
  "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.eyJleHAiOjE3NjU1OTg0NzQsImp0aSI6ImU0YzAyZjcxLWQ4NDktNDZlYS1iNzNmLTY1YjU0YTc3MTJjZCIsInVzZXJJbmZvIjp7ImlkIjowLCJ1c2VySWQiOiI0MjEzNzg1MjQ3IiwidXNlcm5hbWUiOiIiLCJlbWFpbCI6ImZlbGl4LnNo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UniversalContent(headers=head, host='https://test.smartpushedm.com/bff/api-sp-market-ec2') \
165
- .assert_block_in_the_section('Section23452345234', block_universa_name=['5555345243'])
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)
@@ -55,8 +55,8 @@ def json_to_dict(json_data=None):
55
55
  json_result = json.load(file)
56
56
  return json_result
57
57
 
58
- def all_in_list(list_a, list_b):
59
58
 
59
+ def all_in_list(list_a, list_b):
60
60
  """
61
61
  判断元素是否都在list_b中
62
62
  :param list_a:
@@ -64,9 +64,9 @@ def all_in_list(list_a, list_b):
64
64
  :return:
65
65
  """
66
66
  if isinstance(list_a, str):
67
- print(f"字符串【{list_a}】在 {list_b}")
67
+ print(f"判断字符串【{list_a}】在 {list_b}")
68
68
  return list_a in list_b
69
69
  else:
70
70
  # 支持列表、元组、集合等可迭代类型
71
- print(f"对象【{list_a}】在 {list_b}")
71
+ print(f"判断对象【{list_a}】在 {list_b}")
72
72
  return set(list_a).issubset(set(list_b))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.9.5
3
+ Version: 1.9.7
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: lulu、felix、long
6
6
 
@@ -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=7R-aJyMKJ7d50bbyi-2tCUuqR9JfHsZIU-jGhbSVaSU,2406
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
12
  smartpush/email/schema.py,sha256=Gf9tYNP9UjkbXpPbh_uAcAx7QZ5RNs-E7GPVp1BU9d8,23478
13
- smartpush/email/universal_content.py,sha256=MPGrquHFpxFaX6g8LNfwNxaQvJkvhsbzPU20IJfHRB0,7676
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=LEQG9J9q7st5GHbM8rpDz5mlPbSWU8fOQMPcIKEAmXg,2812
30
+ smartpush/utils/ListDictUtils.py,sha256=HFjBTtSgMv5lxV53qyRGNVkjLmx454_SDIBrSh2RrZk,2824
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.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,,
34
+ smartpush-1.9.7.dist-info/METADATA,sha256=krn6EjNisMYKHIWS3SKMx1aMzbTgVecLBSb6ybNbz3c,131
35
+ smartpush-1.9.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
36
+ smartpush-1.9.7.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
37
+ smartpush-1.9.7.dist-info/RECORD,,