Commit graph

2208 commits

Author SHA1 Message Date
neiljp (Neil Pilgrim) 56c59d915a bots: Support determining bot runtime identity.
This improves the ability of a bot to specify how to mention it,
which varies at run-time depending upon the identity used to run it;
this is commonly used in many bot help commands.
2018-05-31 06:10:50 -04:00
neiljp (Neil Pilgrim) 4c8d86c1d9 bot lib tests: Move tests of bot library to tests/.
This makes it clearer which files are for writing bot tests
vs tests of the infrastructure.
2018-05-30 18:29:47 -07:00
Tim Abbott 9e6b4edee6 integrations: Remove slack import script.
This was migrated to the Zulip server project some time ago.
2018-05-30 16:10:22 -07:00
Robert Hönig f4e0808a87 botserver: Validate token before accepting message.
Previously, the botserver would accept any message sent
to it. This was a security hazard, since an attacker could
impersonate arbitrary users with arbitrary messages. We only
want the Zulip instance where a bot is registered to be able
to send out messages for that bot. To do this, this commits
adds a check for the security token associated with each
outgoing webhook bot. For each bot, its token is stored in
the botserverrc file. The server sends the token along with
each message.
2018-05-30 09:37:33 -04:00
neiljp (Neil Pilgrim) efe5b04374 salesforce: Minor improvements; imports & types. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) 8f0b9adb70 trello: Remove extra newlines & spaces in code and tests. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) 4f224b5dbc trello: Simplify message & response handling. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) 8e1d4f524b baremetrics: Remove extra newlines & spaces in code and tests. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) b51b6d0361 baremetrics: Simplify response generation. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) 016011437e baremetrics: Simplify core handler code. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) ce4404b9db idonethis: Remove extra newlines in code & tests.
Also rename list_steams -> list_teams.
2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) 9b782e8357 idonethis: Improve typing & note unused function. 2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) dbe44a2774 idonethis: Remove unreachable code & simplify response generation.
Also remove unnecessary import.
2018-05-30 07:11:16 -04:00
neiljp (Neil Pilgrim) 4e19a7716d mypy: Avoid 'Any' for message in bots.
Also remove a few unnecessary typing imports.
2018-05-30 07:11:16 -04:00
novokrest 7a95c31162 mercurial: Rename hook file to zulip_changegroup.py.
Rename hook file from 'zulip-changegroup.py'
to 'zulip_changegroup.py' for importing as module.
2018-05-29 11:45:56 -07:00
novokrest 9b9070808f mercurial: Update changegroup hook according to new mercurial API.
Fixes #322
2018-05-29 11:45:56 -07:00
Tim Abbott d14a025ff9 provision: Make the source line stand out more. 2018-05-29 11:32:45 -07:00
Tim Abbott 6ca216024f matrix: Fix typo in requirements.txt. 2018-05-29 11:05:01 -07:00
Robert Hönig 8e653fe064 linter: Add rule to favor Botserver over botserver or bot server. 2018-05-29 10:59:15 +02:00
Robert Hönig 64a1306e39 Consistently use Botserver instead of botserver or bot server. 2018-05-29 10:58:37 +02:00
Robert Hönig 762118bbea Rename flaskbotrc to botserverrc. 2018-05-29 10:19:50 +02:00
Robert Hönig 3859bef05f botserver: Make handle_bot logic more concise. 2018-05-29 10:05:32 +02:00
Robert Hönig e6ef34a964 botserver: Strip messages like we do in zulip-run-bot.
Previously, messages weren't stripped at all. This
caused most bots to break and send replies similar to
"I didn't understand your command". Nobody noticed,
because the tests were only validating that replies
were sent, but not the content in them. Thus, this
commit also adds tests to avoid further regressions.
2018-05-29 10:05:19 +02:00
Robert Hönig f1bcf3b9a4 botserver: Remove redundant message check.
Previously, the botserver `handle_bot` routine did two checks
on an incoming message:
* First, it checked if the bot email matches
an email in the flaskbotrc.
* Second, it checked if the bot name that corresponds to an email
has a lib module loaded. However, this must be the case, because
all lib modules for all emails are loaded on initialization. Thus,
this commit removes the second check.
2018-05-29 09:52:14 +02:00
Robert Hönig 5c062cee0d botserver: Verify bot response.
This allows for more realistic testing.
2018-05-28 11:13:56 -07:00
Robert Hönig 4285cef29c assert_bot_server_response: Mock ExternalBotHandler. 2018-05-28 11:13:56 -07:00
Robert Hönig 27938a926b Rename assert_bot_server_response param message to event.
It's an event, not a message.
2018-05-28 11:13:56 -07:00
Robert Hönig 48f2c2ae36 Remove default value from assert_bot_server_response message parameter.
This is the first step in validating the bot responses for the
botserver. The default value for `message` was nonsense and
wouldn't trigger a bot in real life. Additionally, we'll want
each test to use a proper message tailored to the test. Thus,
this commit removes a 'default' message alltogether.
2018-05-28 11:13:55 -07:00
Robert Hönig 6a8cb2965c zulip_botserver: Handle all requests from the root / endpoint.
Previously, the Botserver determined which bot to run by dispatching on
a unique URL endpoint /bots/<botname> for each bot.
Now, instead, the Botserver determines which bot to run by the section
header of the bot in the flaskbotrc.
2018-05-28 15:09:39 +02:00
Robert Hönig 6249df0ad7 bots: Don't run tests for monkeytestit bot.
The monkeytestit tests fail on Python3.4 because
one of their dependencies only works on Python3.5.
This is a hotfix to make builds pass again. We'll
want to find a proper way of Python version conditional
bot test execution.
2018-05-28 13:43:15 +02:00
Robert Hönig 47c879407c monkeytestit bot tests: Import bot class inside test.
We need to import the bot class inside the tests, so
we are able to temporarily resolve problems with the
bot class by simply skipping the test. It also makes
the code look nicer.
2018-05-28 13:43:15 +02:00
Robert Hönig a8045a8fa9 mypy: Fix paths to chessbot files. 2018-05-28 13:43:15 +02:00
neiljp (Neil Pilgrim) a178f93087 test-bots: Detect absent __init__.py & optionally exit. 2018-05-26 17:28:25 -07:00
neiljp (Neil Pilgrim) bda678344f test-bots: Extract common filter out of conditional. 2018-05-26 17:28:25 -07:00
neiljp (Neil Pilgrim) 210caa4a60 test-bots: Extract test discovery out of conditional.
This (re?)-enables exclusion of bot names from eg. `test-bots`.
2018-05-26 17:22:03 -07:00
neiljp (Neil Pilgrim) a5307b3771 test-bots: Use unused available_bots to discover tests. 2018-05-26 17:22:03 -07:00
neiljp (Neil Pilgrim) 76b2befb9b test-bots: Remove unused function parameter. 2018-05-26 17:22:03 -07:00
neiljp (Neil Pilgrim) 1d60794f1c test-bots: Simplify and unify test discovery. 2018-05-26 17:21:54 -07:00
neiljp (Neil Pilgrim) 4364dc7599 chess: Rename to chessbot to avoid naming conflict with engine. 2018-05-26 16:12:25 -07:00
neiljp (Neil Pilgrim) 9e5c929c86 witai: Add __init__.py and fix tests. 2018-05-26 14:36:26 -07:00
neiljp (Neil Pilgrim) 17ad4f61ab twitpost: Add __init__.py and requirements.txt. 2018-05-26 14:36:26 -07:00
neiljp (Neil Pilgrim) 937de114a7 bots: Add 3 missing __init__.py files.
Tests run ok for these bots.
2018-05-26 14:36:26 -07:00
neiljp (Neil Pilgrim) 668a4ed634 game_of_fifteen: Use consistent naming & simplify imports. 2018-05-26 14:36:26 -07:00
Tim Abbott efcdc712bf matrix: Edit matrix.org README further.
The README is still pretty rough, but this cleans it up a bit.
2018-05-22 14:01:24 -07:00
Rhea Parekh 4c9134815c Matrix: Make minor changes to README.md and config. 2018-05-22 14:01:24 -07:00
Rhea Parekh afb964b65a Matrix: Add command line flag to ignore join/leave events.
Add command line flag 'no_noise' (which is true by default)
to ignore join/leave events. User can enable those events
by pass 'no_noise' as false.
2018-05-22 14:01:24 -07:00
Rhea Parekh 8e1274f555 Matrix: Change naming convention. 2018-05-22 14:01:24 -07:00
Eeshan Garg 00f22e175c pypi: Release 0.4.7. 2018-05-21 20:02:43 -02:30
Sivagiri Visakan 4183f4c0c5 zulip-terminal: Add bot's directory to sys.path. 2018-05-20 07:07:43 -04:00
dkvasov 79899dba30 zulip_botserver: More test cases. 2018-05-17 09:43:00 -07:00