smartpush 2.0.8__py3-none-any.whl → 2.1.0__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 +2 -1
- smartpush/base/url_enum.py +6 -0
- smartpush/contacts/contacts.py +40 -0
- smartpush/crowd/crowd.py +17 -0
- {smartpush-2.0.8.dist-info → smartpush-2.1.0.dist-info}/METADATA +1 -1
- {smartpush-2.0.8.dist-info → smartpush-2.1.0.dist-info}/RECORD +9 -8
- /smartpush/{test.py → contacts/__init__.py} +0 -0
- {smartpush-2.0.8.dist-info → smartpush-2.1.0.dist-info}/WHEEL +0 -0
- {smartpush-2.0.8.dist-info → smartpush-2.1.0.dist-info}/top_level.txt +0 -0
smartpush/base/request_base.py
CHANGED
|
@@ -31,7 +31,7 @@ class RequestBase:
|
|
|
31
31
|
self.session.mount("https://", HTTPAdapter(max_retries=retry_strategy))
|
|
32
32
|
|
|
33
33
|
@retry(stop=stop_after_attempt(3), wait=wait_fixed(2), after=log_attempt)
|
|
34
|
-
def request(self, method, path
|
|
34
|
+
def request(self, method, path,**kwargs):
|
|
35
35
|
url = f"{self.host}{path}"
|
|
36
36
|
print(f"{method} 请求:", url)
|
|
37
37
|
# 统一处理请求参数
|
|
@@ -50,6 +50,7 @@ class RequestBase:
|
|
|
50
50
|
response = self.session.request(method, url, **default_kwargs)
|
|
51
51
|
response.raise_for_status()
|
|
52
52
|
response_json = response.json()
|
|
53
|
+
assert response_json.get('code') == 1 if not kwargs.get('pass_assert_code') else True
|
|
53
54
|
print("响应内容为:\n", json.dumps(response_json, ensure_ascii=False))
|
|
54
55
|
return response_json
|
|
55
56
|
except requests.exceptions.RequestException as e:
|
smartpush/base/url_enum.py
CHANGED
|
@@ -38,6 +38,12 @@ class URL:
|
|
|
38
38
|
crowdPackageDetail = '/crowdPackage/detail', POST
|
|
39
39
|
crowdPackageList = '/crowdPackage/list', POST
|
|
40
40
|
|
|
41
|
+
class Contacts(BaseEnum):
|
|
42
|
+
"""
|
|
43
|
+
:type 联系人
|
|
44
|
+
"""
|
|
45
|
+
getContactPersonList = '/contact/getContactPersonList', POST
|
|
46
|
+
|
|
41
47
|
class Form(BaseEnum):
|
|
42
48
|
"""
|
|
43
49
|
:type 表单操作
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from tenacity import retry, stop_after_attempt, wait_exponential
|
|
5
|
+
|
|
6
|
+
from smartpush.base.request_base import RequestBase
|
|
7
|
+
from smartpush.base.url_enum import URL
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Contacts(RequestBase):
|
|
11
|
+
|
|
12
|
+
def callGetContactPersonList(self, value):
|
|
13
|
+
"""
|
|
14
|
+
查询联系人信息
|
|
15
|
+
:param value:
|
|
16
|
+
:return:
|
|
17
|
+
"""
|
|
18
|
+
requestParam = {"rules": {"query": value}, "sessionId": "", "page": 1, "pageSize": 20}
|
|
19
|
+
result = self.request(method=URL.Contacts.getContactPersonList.method,
|
|
20
|
+
path=URL.Contacts.getContactPersonList.url, data=requestParam)
|
|
21
|
+
return result['resultData']
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AssertContacts(Contacts,):
|
|
25
|
+
tries=3
|
|
26
|
+
@retry(stop=stop_after_attempt(tries), wait=wait_exponential(multiplier=1, min=1, max=2))
|
|
27
|
+
def AssertEmailOrNameInContactPersonList(self, value, subscribeEmailStatus=False, subscribeSmsStatus=False):
|
|
28
|
+
result = self.callGetContactPersonList(value)
|
|
29
|
+
contactPersonDetailList = result['resultData']['contactPersonDetailList']
|
|
30
|
+
for contactPersonDetail in contactPersonDetailList:
|
|
31
|
+
contactPersonDetailEmail = contactPersonDetail['email']
|
|
32
|
+
contactPersonDetailName = contactPersonDetail['userName']
|
|
33
|
+
contactPersonDetailSubscribeEmailStatus = contactPersonDetail['subscribeEmailStatus']
|
|
34
|
+
contactPersonDetailSubscribeSmsStatus = contactPersonDetail['subscribeSmsStatus']
|
|
35
|
+
# 断言内容
|
|
36
|
+
assert contactPersonDetailEmail == value or contactPersonDetailName == value
|
|
37
|
+
assert contactPersonDetailSubscribeEmailStatus == subscribeEmailStatus
|
|
38
|
+
assert contactPersonDetailSubscribeSmsStatus == subscribeSmsStatus
|
|
39
|
+
|
|
40
|
+
|
smartpush/crowd/crowd.py
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import time
|
|
3
3
|
|
|
4
|
+
from tenacity import retry, stop_after_attempt, wait_fixed
|
|
5
|
+
|
|
4
6
|
from smartpush.base.request_base import CrowdRequestBase, RequestBase
|
|
5
7
|
from smartpush.base.url_enum import URL
|
|
6
8
|
from smartpush.export.basic.ExcelExportChecker import compare_dicts
|
|
9
|
+
from smartpush.export.basic.GetOssUrl import log_attempt
|
|
7
10
|
from smartpush.utils import ListDictUtils
|
|
8
11
|
|
|
9
12
|
|
|
@@ -93,6 +96,20 @@ class CrowdList(RequestBase):
|
|
|
93
96
|
resultData = result['resultData']
|
|
94
97
|
return resultData
|
|
95
98
|
|
|
99
|
+
class AssertCrowd(Crowd):
|
|
100
|
+
def __init__(self, crowd_id, host, headers, **kwargs):
|
|
101
|
+
super(AssertCrowd, self).__init__(crowd_id=crowd_id, host=host, headers=headers, **kwargs)
|
|
102
|
+
self.crowd_id = crowd_id
|
|
103
|
+
|
|
104
|
+
@retry(stop=stop_after_attempt(3), wait=wait_fixed(3), after=log_attempt)
|
|
105
|
+
def assert_filter_value_in_person_package(self, page=1, pageSize=20, filter_type=None, operator='eq', filter_value=None):
|
|
106
|
+
try:
|
|
107
|
+
crowd_persons = super.callCrowdPersonListInPackage(page=page, pageSize=pageSize, filter_type=filter_type, operator=operator, filter_value=filter_value)
|
|
108
|
+
assert crowd_persons['num'] >=1
|
|
109
|
+
assert crowd_persons['responseResult'][0][filter_type] == filter_value
|
|
110
|
+
except:
|
|
111
|
+
raise
|
|
112
|
+
|
|
96
113
|
|
|
97
114
|
if __name__ == '__main__':
|
|
98
115
|
host = "https://test.smartpushedm.com/bff/api-em-ec2"
|
|
@@ -1,14 +1,15 @@
|
|
|
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
|
|
7
6
|
smartpush/base/faker_data.py,sha256=-OcFFQnDGpjZR3guo_tHfxV7zQEHo9ciidWGqKv_jNs,25437
|
|
8
|
-
smartpush/base/request_base.py,sha256=
|
|
9
|
-
smartpush/base/url_enum.py,sha256=
|
|
7
|
+
smartpush/base/request_base.py,sha256=uVb1Na-D8K8qBP69sQhiAYvFG3uKMuXQ5PJwnr9-u5k,3035
|
|
8
|
+
smartpush/base/url_enum.py,sha256=47XCczKEvTcO6Ap4VbEfV7K_S0t2xu3O434sHqwycE4,2896
|
|
9
|
+
smartpush/contacts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
smartpush/contacts/contacts.py,sha256=JssmzyHmFF6TeIKpFH6VvGC5abBXOzkSwZrAWA8v8a8,1718
|
|
10
11
|
smartpush/crowd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
smartpush/crowd/crowd.py,sha256=
|
|
12
|
+
smartpush/crowd/crowd.py,sha256=jxX8svt6bRytGLSYiZbCn5RnE7OiRZH0QGgPawlMhMU,10646
|
|
12
13
|
smartpush/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
14
|
smartpush/email/activity.py,sha256=rQ62GIfg0Yh0fFkwiaRIVATBn5vY1wZzbLEJLwHmx1E,10016
|
|
14
15
|
smartpush/email/schema.py,sha256=mysik-N6cry4HuSxzMMhQFsnnu5_UJ_oqVPTGY1RUkQ,31471
|
|
@@ -36,7 +37,7 @@ smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrA
|
|
|
36
37
|
smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
38
|
smartpush/utils/date_utils.py,sha256=Xgx2DbmWYri71xXBiaKYTZDeh2a8MFhYns_xB0U2JOA,13159
|
|
38
39
|
smartpush/utils/form_utils.py,sha256=ld-g_Dm_ZlnagQt7imYfUc87bcBRVlTctywuLtzmjXQ,849
|
|
39
|
-
smartpush-2.0.
|
|
40
|
-
smartpush-2.0.
|
|
41
|
-
smartpush-2.0.
|
|
42
|
-
smartpush-2.0.
|
|
40
|
+
smartpush-2.1.0.dist-info/METADATA,sha256=sjwzBM86P_76kduitL3FyIspyM5FmzXi31jp4i3AEY4,131
|
|
41
|
+
smartpush-2.1.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
42
|
+
smartpush-2.1.0.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
|
43
|
+
smartpush-2.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|