Closed csaftoiu closed 7 years ago
Steps to reproduce:
Set up the test file like this:
testbot_apitoken = '... redacted ...' testbot_username = 'slackbot-test' driver_apitoken = '... redacted ...' driver_username = 'csaftoiu' test_channel = 'testchannel' test_group = 'testprivate'
Run py.test like so:
py.test
$ py.test -k test_bot_channel_reply
And the error is:
platform darwin -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- /Users/csaftoiu/csaftoiu-github/slackbot/.env/bin/python3.5 cachedir: .cache rootdir: /Users/csaftoiu/csaftoiu-github/slackbot, inifile: pytest.ini collected 39 items tests/functional/test_functional.py::test_bot_channel_reply_to_name_colon [06/23/2016 19:57:57] using aliases !,$ [06/23/2016 19:57:57] loading plugin "slackbot.plugins" [06/23/2016 19:57:57] registered respond_to plugin "hello_reply" to "hello$" [06/23/2016 19:57:57] registered respond_to plugin "hello_webapi" to "^reply_webapi$" [06/23/2016 19:57:57] registered respond_to plugin "hello_webapi_not_as_user" to "^reply_webapi_not_as_user$" [06/23/2016 19:57:57] registered respond_to plugin "hello_reply_formatting" to "hello_formatting" [06/23/2016 19:57:57] registered listen_to plugin "hello_send" to "hello$" [06/23/2016 19:57:57] registered respond_to plugin "hello_decorators" to "hello_decorators" [06/23/2016 19:57:57] registered listen_to plugin "hello_decorators" to "hello_decorators" [06/23/2016 19:57:57] registered listen_to plugin "hey" to "hey!" [06/23/2016 19:57:57] registered respond_to plugin "hello_unicode_message" to "你好" [06/23/2016 19:57:57] registered respond_to plugin "upload" to "upload \<?(.*)\>?" [06/23/2016 19:57:59] connected to slack RTM api [06/23/2016 19:57:59] keep active thread started FAILED ===================================================== FAILURES ====================================================== _______________________________________ test_bot_channel_reply_to_name_colon ________________________________________ driver = <tests.functional.driver.Driver object at 0x10d193e48> def test_bot_channel_reply_to_name_colon(driver): driver.send_channel_message('hello', tobot=False, toname=True) > driver.wait_for_bot_channel_message('hello sender!') tests/functional/test_functional.py:120: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/functional/driver.py:91: in wait_for_bot_channel_message self._wait_for_bot_message(self.cm_chan, match, tosender=tosender) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.functional.driver.Driver object at 0x10d193e48>, channel = 'C1KSS1QKE', match = 'hello sender!' maxwait = 60, tosender = True def _wait_for_bot_message(self, channel, match, maxwait=60, tosender=True): for _ in range(maxwait): time.sleep(1) if self._has_got_message_rtm(channel, match, tosender): break else: > raise AssertionError('expected to get message like "{}", but got nothing'.format(match)) E AssertionError: expected to get message like "hello sender!", but got nothing tests/functional/driver.py:146: AssertionError ================================= 38 tests deselected by '-ktest_bot_channel_reply' ================================= ===================================== 1 failed, 38 deselected in 65.01 seconds ======================================
On the Slack channel, the exchange is:
csaftoiu> slackbot-test: hello slackbot-test> hello channel!
That is, it thinks it's to the channel, not to the bot itself.
I think this is fixed, but please reopen if it's still a problem.
Steps to reproduce:
Set up the test file like this:
Run
py.test
like so:And the error is:
On the Slack channel, the exchange is:
That is, it thinks it's to the channel, not to the bot itself.