Skip to content

Commit d5fb8e8

Browse files
committed
[slack] Update function name for better readability
- detect_select_statement -> handle_select_statement
1 parent d17a010 commit d5fb8e8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

desktop/core/src/desktop/lib/botserver/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ def handle_on_message(host_domain, is_http_secure, channel_id, bot_id, elements,
101101
_send_message(channel_id, bot_message)
102102

103103
if text.lower().startswith('select'):
104-
detect_select_statement(host_domain, is_http_secure, channel_id, user_id, text.lower())
104+
handle_select_statement(host_domain, is_http_secure, channel_id, user_id, text.lower())
105105

106106

107-
def detect_select_statement(host_domain, is_http_secure, channel_id, user_id, statement):
107+
def handle_select_statement(host_domain, is_http_secure, channel_id, user_id, statement):
108108
slack_user = check_slack_user_permission(host_domain, user_id)
109109
user = get_user(channel_id, slack_user)
110110

desktop/core/src/desktop/lib/botserver/views_tests.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def setUp(self):
6262

6363
def test_handle_on_message(self):
6464
with patch('desktop.lib.botserver.views._send_message') as _send_message:
65-
with patch('desktop.lib.botserver.views.detect_select_statement') as detect_select_statement:
65+
with patch('desktop.lib.botserver.views.handle_select_statement') as handle_select_statement:
6666

6767
channel_id = "channel"
6868
bot_id = "bot_id"
@@ -97,9 +97,9 @@ def test_handle_on_message(self):
9797
]
9898

9999
handle_on_message(self.host_domain, self.is_http_secure, channel_id, None, message_element, user_id)
100-
detect_select_statement.assert_called_with(self.host_domain, self.is_http_secure, channel_id, user_id, 'select 1')
100+
handle_select_statement.assert_called_with(self.host_domain, self.is_http_secure, channel_id, user_id, 'select 1')
101101

102-
def test_detect_select_statement(self):
102+
def test_handle_select_statement(self):
103103
with patch('desktop.lib.botserver.views.check_slack_user_permission') as check_slack_user:
104104
with patch('desktop.lib.botserver.views.get_user') as get_user:
105105
with patch('desktop.lib.botserver.views.get_cluster_config') as get_cluster_config:
@@ -119,7 +119,7 @@ def test_detect_select_statement(self):
119119
'link': 'gist_link'
120120
}
121121

122-
detect_select_statement(self.host_domain, self.is_http_secure, channel_id, user_id, statement)
122+
handle_select_statement(self.host_domain, self.is_http_secure, channel_id, user_id, statement)
123123
_send_message.assert_called_with(
124124
channel_id,
125125
('Hi <@user_id>\n'

0 commit comments

Comments
 (0)