smartpush 1.5.7__py3-none-any.whl → 1.5.8__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.
@@ -38,21 +38,33 @@ class RequestBase:
38
38
  "timeout": 30,
39
39
  "headers": self.headers
40
40
  }
41
+ response_json = None
41
42
  default_kwargs.update(kwargs)
42
- if default_kwargs.get('data'): # 如果data有值json序列化
43
+ if default_kwargs.get('data'): # 如果data有值json序列化
43
44
  data = json.dumps(default_kwargs.get('data'))
44
45
  default_kwargs.update({'data': data})
45
46
  try:
46
47
  response = self.session.request(method, url, **default_kwargs)
47
48
  response.raise_for_status()
48
- print("响应内容为:\n", response.json())
49
- return response.json()
49
+ response_json = response.json()
50
+ print("响应内容为:\n", json.dumps(response_json))
51
+ assert response_json['code'] == 1
52
+ return response_json
50
53
  except requests.exceptions.RequestException as e:
51
54
  print(f"请求失败: {e}")
52
55
  return None
56
+ except Exception as e:
57
+ print("响应内容为:\n", json.dumps(response_json))
58
+ raise e
53
59
 
54
60
 
55
61
  class FormRequestBase(RequestBase):
56
- def __init__(self, form_id, host, headers):
57
- super().__init__(host, headers)
62
+ def __init__(self, form_id, host, headers, **kwargs):
63
+ super().__init__(host, headers, **kwargs)
58
64
  self.form_id = form_id
65
+
66
+
67
+ class CrowdRequestBase(RequestBase):
68
+ def __init__(self, crowd_id, host, headers, **kwargs):
69
+ super().__init__(host, headers, **kwargs)
70
+ self.crowd_id = crowd_id
@@ -15,6 +15,7 @@ class URL(Enum):
15
15
  """
16
16
  editCrowdPackage = '/crowdPackage/editCrowdPackage', 'POST'
17
17
  crowdPersonList = '/crowdPackage/crowdPersonList', 'POST'
18
+ crowdPackageDetail = '/crowdPackage/detail', 'GET'
18
19
 
19
20
  """
20
21
  :type 表单操作
File without changes
@@ -0,0 +1,52 @@
1
+ from smartpush.base.request_base import CrowdRequestBase
2
+ from smartpush.base.url_enum import URL
3
+
4
+
5
+ class Crowd(CrowdRequestBase):
6
+
7
+ def callEditCrowdPackage(self, crowdName="", groupRules=None, groupRelation="$AND",
8
+ triggerStock=False):
9
+ """
10
+ 更新群组条件id
11
+ :param triggerStock:
12
+ :param crowdName:
13
+ :param groupRules:
14
+ :param groupRelation:
15
+ :return:
16
+ """
17
+ requestParam = {"id": self.crowd_id, "crowdName": crowdName, "groupRelation": groupRelation,
18
+ "groupRules": groupRules, "triggerStock": triggerStock}
19
+ result = self.request(method=URL.editCrowdPackage.method, path=URL.editCrowdPackage.url, data=requestParam)
20
+ return result['resultData']
21
+
22
+ def callCrowdPersonList(self, page=1, pageSize=20, filter_type=None, filter_value=None):
23
+ """
24
+ 获取群组联系人列表
25
+ :param page:
26
+ :param pageSize:
27
+ :param filter_type:
28
+ :param filter_value:
29
+ :return:
30
+ """
31
+ requestParam = {"id": self.crowd_id, "page": page, "pageSize": pageSize}
32
+ if filter_value is not None:
33
+ requestParam["filter"] = {filter_type: {"in": filter_value}}
34
+ result = self.request(method=URL.crowdPersonList.method, path=URL.crowdPersonList.url, data=requestParam)
35
+ resultData = result['resultData']
36
+ return resultData
37
+
38
+ def callCrowdPackageDetail(self, page=1, pageSize=20, filter_type=None, filter_value=None):
39
+ """
40
+ 获取群组详情
41
+ :param page:
42
+ :param pageSize:
43
+ :param filter_type:
44
+ :param filter_value:
45
+ :return:
46
+ """
47
+ requestParam = {"id": self.crowd_id, "page": page, "pageSize": pageSize, "filter": {}}
48
+ if filter_value is not None:
49
+ requestParam["filter"] = {filter_type: {"in": filter_value}}
50
+ result = self.request(method=URL.crowdPersonList.method, path=URL.crowdPackageDetail.url, data=requestParam)
51
+ resultData = result['resultData']
52
+ return resultData
@@ -2,6 +2,7 @@ import json
2
2
  from tenacity import retry, stop_after_attempt, wait_fixed
3
3
  from smartpush.base.request_base import FormRequestBase
4
4
  from smartpush.base.url_enum import URL
5
+ from smartpush.crowd import crowd
5
6
  from smartpush.export.basic.GetOssUrl import log_attempt
6
7
 
7
8
 
@@ -40,30 +41,6 @@ class FormAfter(FormRequestBase):
40
41
  resultData = result["resultData"]
41
42
  return resultData
42
43
 
43
- def callEditCrowdPackage(self, _id=None, groupRules=None, groupRelation="$AND"):
44
- """
45
- 更新群组条件id
46
- :param _id:
47
- :param groupRules:
48
- :param groupRelation:
49
- :return:
50
- """
51
- requestParam = {"id": _id, "crowdName": "表单查询群组-自动化", "groupRelation": groupRelation,
52
- "groupRules": groupRules, "triggerStock": False}
53
- result = self.request(method=URL.editCrowdPackage.method, path=URL.editCrowdPackage.url, data=requestParam)
54
- assert result.get("code") == 1
55
- resultData = result["resultData"]
56
- assert resultData.get("status") == 2
57
- return resultData["id"]
58
-
59
- def callCrowdPersonList(self, _id, page, pageSize, filter_type, filter_value):
60
- requestParam = {"id": _id, "page": page, "pageSize": pageSize}
61
- if filter_value is not None:
62
- requestParam["filter"] = {filter_type: {"in": filter_value}}
63
- result = self.request(method=URL.crowdPersonList.method, path=URL.crowdPersonList.url, data=requestParam)
64
- result.raise_for_status()
65
- return result['resultData']
66
-
67
44
  def callGetFormList(self, formName):
68
45
  requestParam = {'page': 1, 'pageSize': 10, 'name': formName}
69
46
  result = self.request(method=URL.getFormList.method, path=URL.getFormList.url, data=requestParam)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.5.7
3
+ Version: 1.5.8
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: lulu、felix、long
6
6
 
@@ -4,8 +4,10 @@ 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=JCkISn2mp_Aaugv_ZaNtFQrVaHtjQPxGgko6kCXOdlk,1848
8
- smartpush/base/url_enum.py,sha256=_RcBMjDMWS_KOAK9T0HKG9msOWZLJGiKYKC4W5lOKjU,965
7
+ smartpush/base/request_base.py,sha256=PpWVYQEBQN6FZtXJNDGx29qPsRKN7o_299HfK_Vr1jE,2297
8
+ smartpush/base/url_enum.py,sha256=PmU44Qj3yvHZPYovx5F8DQ7FQRMjq9Tw0JHV7kHpXM0,1020
9
+ smartpush/crowd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ smartpush/crowd/crowd.py,sha256=x1a-2LSbKx8GZhmJ8hkY9csMa9W6khOr40dflSvEJYU,2088
9
11
  smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
10
12
  smartpush/export/basic/ExcelExportChecker.py,sha256=3IAeu1kjFS4MpDxjVB1htAcRA1BtfpH3xEkZyP4htAA,19963
11
13
  smartpush/export/basic/GetOssUrl.py,sha256=LeF1y1_uJaYXth1KvO6mEDS29ezb9tliBv5SrbqYkXc,6136
@@ -14,7 +16,7 @@ smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0F
14
16
  smartpush/flow/MockFlow.py,sha256=MI8WIMZyKlxrV5QVs8rXX6iD07Ldl37_L5Yb5FWqHzU,8595
15
17
  smartpush/flow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
18
  smartpush/form/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- smartpush/form/form_after.py,sha256=sRvdYguJ-oJOQ3gOyfubh1xiZOq40O5E35rluOmsykc,9441
19
+ smartpush/form/form_after.py,sha256=VzBRDCzUmrgdSQu_Mr2ccbqkQvVCr71vei2utmvPbwI,8334
18
20
  smartpush/form/form_assert.py,sha256=wPIRfQHhr7lN1fFd-mp0z_qKMtF4jfrNxRWvp2xfqCg,257
19
21
  smartpush/form/form_before.py,sha256=CCvAC_2yWPlnQGtjEA8LPLy9853Nq3nNjcL2GewFWIs,175
20
22
  smartpush/form/form_client_operation.py,sha256=gg-5uHXCyMa_ypBSYPYFVxXdwZdYBJsNtUCqayknMBw,303
@@ -24,7 +26,7 @@ smartpush/utils/ListDictUtils.py,sha256=Fm5_d7UyY6xB8gySMPdl5jIFSRhXZcYXdYW-_L1a
24
26
  smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrAo,4139
25
27
  smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
28
  smartpush/utils/form_utils.py,sha256=ld-g_Dm_ZlnagQt7imYfUc87bcBRVlTctywuLtzmjXQ,849
27
- smartpush-1.5.7.dist-info/METADATA,sha256=FL6Z9J-yTkIiTCPhEQEma2LEyVolTLnJxoOq93bAlC4,131
28
- smartpush-1.5.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
29
- smartpush-1.5.7.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
30
- smartpush-1.5.7.dist-info/RECORD,,
29
+ smartpush-1.5.8.dist-info/METADATA,sha256=ka9ntRxvwReN7Fgq1j69QX8_An4XFlw2Pon8G6RQYFg,131
30
+ smartpush-1.5.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
31
+ smartpush-1.5.8.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
32
+ smartpush-1.5.8.dist-info/RECORD,,