Support Slack URLs missing channel references (#108)

This commit is contained in:
Chris Caron
2019-05-11 15:02:56 -04:00
committed by GitHub
parent 333926c359
commit 51a5ce344a
3 changed files with 54 additions and 68 deletions

View File

@ -1671,8 +1671,8 @@ TEST_URLS = (
'instance': plugins.NotifySlack,
}),
('slack://username@T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ', {
# Missing a channel
'instance': TypeError,
# Missing a channel, falls back to webhook channel bindings
'instance': plugins.NotifySlack,
}),
('slack://username@INVALID/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ/#cool', {
# invalid 1st Token
@ -3157,17 +3157,6 @@ def test_notify_slack_plugin(mock_post, mock_get):
mock_post.return_value.status_code = requests.codes.ok
mock_get.return_value.status_code = requests.codes.ok
# Empty Channel list
try:
plugins.NotifySlack(
token_a=token_a, token_b=token_b, token_c=token_c,
targets=None)
assert False
except TypeError:
# we'll thrown because an empty list of channels was provided
assert True
# Missing first Token
try:
plugins.NotifySlack(