mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07: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:
parent
5424c47d2f
commit
0c0490298f
3 changed files with 72 additions and 16 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue