Added Google Chat Support (#346)

This commit is contained in:
Chris Caron
2021-01-11 14:23:52 -05:00
parent 23957a3337
commit b69ed1dfa9
5 changed files with 382 additions and 14 deletions

View File

@ -827,6 +827,58 @@ TEST_URLS = (
'test_requests_exceptions': True,
}),
##################################
# NotifyGoogleChat
##################################
('gchat://', {
'instance': TypeError,
}),
('gchat://:@/', {
'instance': TypeError,
}),
# Workspace, but not Key or Token
('gchat://workspace', {
'instance': TypeError,
}),
# Workspace and key, but no Token
('gchat://workspace/key/', {
'instance': TypeError,
}),
# Credentials are good
('gchat://workspace/key/token', {
'instance': plugins.NotifyGoogleChat,
'privacy_url': 'gchat://w...e/k...y/t...n',
}),
# Test arguments
('gchat://?workspace=ws&key=mykey&token=mytoken', {
'instance': plugins.NotifyGoogleChat,
'privacy_url': 'gchat://w...s/m...y/m...n',
}),
# Google Native Webhohok URL
('https://chat.googleapis.com/v1/spaces/myworkspace/messages'
'?key=mykey&token=mytoken', {
'instance': plugins.NotifyGoogleChat,
'privacy_url': 'gchat://m...e/m...y/m...n'}),
('gchat://workspace/key/token', {
'instance': plugins.NotifyGoogleChat,
# force a failure
'response': False,
'requests_response_code': requests.codes.internal_server_error,
}),
('gchat://workspace/key/token', {
'instance': plugins.NotifyGoogleChat,
# throw a bizzare code forcing us to fail to look it up
'response': False,
'requests_response_code': 999,
}),
('gchat://workspace/key/token', {
'instance': plugins.NotifyGoogleChat,
# Throws a series of connection and transfer exceptions when this flag
# is set and tests that we gracfully handle them
'test_requests_exceptions': True,
}),
##################################
# NotifyGotify
##################################