mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Slack: Add bot/user token support, correct thread_ts support (#123)
* Slack: Add bot/user token support, correct thread_ts support Add support for user/bot/application tokens (and Slack WebAPI). Fix input type for thread_id, which needs to be string. Return thread_ts/thread_id when user/bot tokens are used, so they can be reused later * Slack: Add changelog fragment, fix YAML syntax Co-authored-by: Middleton, Michal <Michal.Middleton@concur.com>
This commit is contained in:
@@ -68,7 +68,7 @@ class TestSlackModule(ModuleTestCase):
|
||||
set_module_args({
|
||||
'token': 'XXXX/YYYY/ZZZZ',
|
||||
'msg': 'test',
|
||||
'thread_id': 100.00
|
||||
'thread_id': '100.00'
|
||||
})
|
||||
|
||||
with patch.object(slack, "fetch_url") as fetch_url_mock:
|
||||
@@ -80,7 +80,7 @@ class TestSlackModule(ModuleTestCase):
|
||||
call_data = json.loads(fetch_url_mock.call_args[1]['data'])
|
||||
assert call_data['username'] == "Ansible"
|
||||
assert call_data['text'] == "test"
|
||||
assert call_data['thread_ts'] == 100.00
|
||||
assert call_data['thread_ts'] == '100.00'
|
||||
assert fetch_url_mock.call_args[1]['url'] == "https://hooks.slack.com/services/XXXX/YYYY/ZZZZ"
|
||||
|
||||
def test_message_with_invalid_color(self):
|
||||
|
||||
Reference in New Issue
Block a user