Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TestAuto
InterfaceAutoTest
Commits
836e63b5
Commit
836e63b5
authored
Sep 22, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置钉钉消息发送
parent
0ca3c2fc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
common/tools.py
+1
-1
common/utils/dingTalk.py
+24
-3
config.py
+5
-0
No files found.
common/tools.py
View file @
836e63b5
...
...
@@ -97,7 +97,7 @@ def send_dingding(product_name):
if
product_name
==
BmyConfig
.
name
:
dingTalk_markdown_bmy
(
BaseConfig
.
bmy_group
)
# 给交委项目相关群发送钉钉
if
product_name
==
SSOConfig
.
name
:
pass
dingTalk_markdown_sso
(
BaseConfig
.
sso_group
)
# 交委
if
product_name
==
SafeTransportationConfig
.
name
:
dingTalk_markdown_safe_transportation
(
BaseConfig
.
bmy_group
)
...
...
common/utils/dingTalk.py
View file @
836e63b5
...
...
@@ -86,7 +86,7 @@ def dingTalk_markdown_bmy(group):
"markdown"
:
{
"title"
:
"接口执行报告"
,
"text"
:
f
"#### 接口自动化测试报告
\n
> 本消息由Jenkins构建后自动发送
\n
>
\

\n
> ###### 点击查看 >> [安全运输
](http://10.197.236.10:8080/job/bmy/allure/)
\n
"
\n
> ###### 点击查看 >> [企业云测试报告
](http://10.197.236.10:8080/job/bmy/allure/)
\n
"
},
'at'
:
{
'isAtAll'
:
False
}}
post_data
=
json
.
dumps
(
data
)
...
...
@@ -103,14 +103,34 @@ def dingTalk_markdown_safe_transportation(group):
"markdown"
:
{
"title"
:
"接口执行报告"
,
"text"
:
f
"#### 接口自动化测试报告
\n
> 本消息由Jenkins构建后自动发送
\n
>
\

\n
> ###### 点击查看 >> [交委安全运输监管平台](http://10.197.236.10:8080/job/safe_transportation/allure/)
\n
"
\n
> ###### 点击查看 >> [交委安全运输监管平台](http://10.197.236.10:8080/job/safe_transportation/allure/)
\n
"
},
'at'
:
{
'isAtAll'
:
False
}}
post_data
=
json
.
dumps
(
data
)
requests
.
post
(
webhook
,
headers
=
BaseConfig
.
headers
,
data
=
post_data
)
def
dingTalk_markdown_sso
(
group
):
for
i
in
group
:
"""发送消息到钉钉群(sso)"""
timestamp
=
str
(
round
(
time
.
time
()
*
1000
))
sign
=
get_sign
(
i
[
"secret"
])
webhook
=
i
[
"webhook"
]
+
f
"×tamp={timestamp}&sign={sign}"
now_time
=
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M'
)
data
=
{
'msgtype'
:
'markdown'
,
"markdown"
:
{
"title"
:
"接口执行报告"
,
"text"
:
f
"#### 接口自动化测试报告
\n
> 本消息由Jenkins构建后自动发送
\n
>
\
\n
> ###### 点击查看 >> [统一登录平台](http://10.197.236.10:8080/job/sso/allure/)
\n
"
},
'at'
:
{
'isAtAll'
:
False
}}
post_data
=
json
.
dumps
(
data
)
requests
.
post
(
webhook
,
headers
=
BaseConfig
.
headers
,
data
=
post_data
)
# """ 通用 (未调试)"""
# (https://img.banmago.com/group2/M00/06/BB/rBrpX2El37CASho8ABlIIu9o6i4942.png)
# def dingTalk_markdown(group,picture,title,allureurl):
# for i in group:
# timestamp = str(round(time.time() * 1000))
...
...
@@ -149,6 +169,6 @@ if __name__ == '__main__':
{
"secret"
:
"SEC465015385218e70a94f107a16f72dd33d8fc118c3b2a631e0433685302f2fbb3"
,
"webhook"
:
"https://oapi.dingtalk.com/robot/send?access_token=229908a83825ed56abbf728d3382e446a4e8a90e9ad302c37a036bcbccbbf9ee"
,
"group"
:
"自动化小组"
}]
dingTalk_markdown_
safe_transportation
(
bmy
_group
)
dingTalk_markdown_
bmy
(
test
_group
)
# dingTalk_markdown(test_group,"https://aqjg.gyszhjt.com:60028/img/group1/M00/00/04/Cgs5XWD2NrOACeeHAAhEU1jS9Xc475.png","交委项目","http://10.197.236.10:8080/job/bmc/allure/")
\ No newline at end of file
config.py
View file @
836e63b5
...
...
@@ -32,6 +32,11 @@ class BaseConfig():
"group"
:
"测试序列"
}
]
# 统一登录平台钉钉发送群
sso_group
=
[{
"secret"
:
"SEC7714672a0be0239dbff12083d6beca3961490f1f5384c616ea259015d7e71cd1"
,
"webhook"
:
"https://oapi.dingtalk.com/robot/send?access_token=10baf66992f12849793666ee882569bf50d313e9c070ab1afbff25cb9ffcd567"
,
"group"
:
"测试序列"
}]
# 日志相关
log_path
=
r''
# 日志路径
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment