Added DingTalk Support (#200)

This commit is contained in:
Chris Caron
2021-08-11 07:37:58 -04:00
committed by GitHub
parent bca44c02a5
commit 06b6ed4d2c
5 changed files with 426 additions and 18 deletions

View File

@ -260,6 +260,71 @@ TEST_URLS = (
'test_requests_exceptions': True,
}),
##################################
# NotifyDingTalk
##################################
('dingtalk://', {
# No Access Token specified
'instance': TypeError,
}),
('dingtalk://a_bd_/', {
# invalid Access Token
'instance': TypeError,
}),
('dingtalk://12345678', {
# access token
'instance': plugins.NotifyDingTalk,
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'dingtalk://1...8',
}),
('dingtalk://{}/{}'.format('a' * 8, '1' * 14), {
# access token + phone number
'instance': plugins.NotifyDingTalk,
}),
('dingtalk://{}/{}/invalid'.format('a' * 8, '1' * 3), {
# access token + 2 invalid phone numbers
'instance': plugins.NotifyDingTalk,
}),
('dingtalk://{}/?to={}'.format('a' * 8, '1' * 14), {
# access token + phone number using 'to'
'instance': plugins.NotifyDingTalk,
}),
# Test secret via user@
('dingtalk://secret@{}/?to={}'.format('a' * 8, '1' * 14), {
# access token + phone number using 'to'
'instance': plugins.NotifyDingTalk,
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'dingtalk://****@a...a',
}),
# Test secret via secret= and token=
('dingtalk://?token={}&to={}&secret={}'.format(
'b' * 8, '1' * 14, 'a' * 15), {
# access token + phone number using 'to'
'instance': plugins.NotifyDingTalk,
'privacy_url': 'dingtalk://****@b...b',
}),
# Invalid secret
('dingtalk://{}/?to={}&secret=_'.format('a' * 8, '1' * 14), {
'instance': TypeError,
}),
('dingtalk://{}?format=markdown'.format('a' * 8), {
# access token
'instance': plugins.NotifyDingTalk,
}),
('dingtalk://{}'.format('a' * 8), {
'instance': plugins.NotifyDingTalk,
# throw a bizzare code forcing us to fail to look it up
'response': False,
'requests_response_code': 999,
}),
('dingtalk://{}'.format('a' * 8), {
'instance': plugins.NotifyDingTalk,
# Throws a series of connection and transfer exceptions when this flag
# is set and tests that we gracfully handle them
'test_requests_exceptions': True,
}),
##################################
# NotifyDiscord
##################################