Commit graph

66 commits

Author SHA1 Message Date
neiljp 1991e0128b contrib_bots: Add check_expected_responses() test helper and use it.
This further simplifies the logic for testing a contrib_bots bot to
require very little code per test in the common case.
2017-05-29 20:39:27 -07:00
Krzysztof Krzysztof 536ab436ed bots: Add weather reporting bot. 2017-05-29 20:33:16 -07:00
Krzysztof Krzysztof 7fa2c45f60 bots: Add Youtube Bot.
This sends the first video from youtube search results as a reply.
2017-05-28 18:13:59 -07:00
neiljp b703d893ba contrib_bots: Add tests for xkcd bot. 2017-05-28 17:59:54 -07:00
Abhijeet Kaur 8cbda46a61 testsuite: Add tests for wikipedia bot in contrib_bots.
Add test file 'Test_wikipedia.py'.

Since wikipedia links for the same query may different according
to relevance. This test will also be written by mocking HTTP
traffic. But this can work for now.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur cff1150231 testsuite: Add tests for virtual_fs bot in contrib_bots.
Add test file 'test_virtual_fs.py'.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur 5d5865fe5e bots: Add a new command 'sample_conversation' in virtual_fs bot.
The previous test function in virtual_Bot made use of another function
called a 'sample_conversation' which had stateful example conversation
with virtual_fs bot.

The function sample_conversation is really useful, so made it accessible
to the users too.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur fd7bbf0098 bots: Remove already present test function in virtual_fs bot.
Remove test function for virtual_fs bot from virtual_fs.py file.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur 728e5dcee6 bots: Modify 'virtual_fs' bot to respond with help message on bot mention.
Earlier, if virtual_fs bot is called without any argument, then the
bot returns nothing.
Now, virtual_fs bot replies with help message on how the user can
call this bot.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur f4c2ed486c testsuite: Add tests for thesaurus bot in contrib_bots.
Add test file 'test_thesaurus.py'.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur 9e653525cf bots: Remove unwanted spaces from 'help_message' in thesaurus bot.
Remove unwanted spaces from the file contrib_bots/bots/thesaurus/thesaurus.py,
these spaces were being stripped while being written to
zulip console.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur 72fadda781 testsuite: Add tests for help bot in contrib_bots.
Add test file 'test_help.py'.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur 9f4948c685 bots: Remove unnecessary split() function from help bot.
Remove unnecessary split() function from the file
contrib_bots/bots/help/help.py and replaced it with equivalent
simpler string.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur a09ebc3b26 testsuite: Add tests for helloworld bot in contrib_bots.
Add test file 'test_helloworld.py'.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur b1573babcb testsuite: Add tests for encrypt bot in contrib_bots.
Remove previous unittest file for encrypt bot. Add new
test file which is in accordance with the test-suite famework
developed for contrib_bots.
2017-05-28 17:12:11 -07:00
Abhijeet Kaur a52269cbe2 testsuite: Add tests for converter bot in contrib_bots.
Remove previous unittest file for converter bot. Add new
test file which is in accordance with the test-suite famework
developed for contrib_bots.

Since 'coverter' folder is now a package (addition of __init__.py),
modify converter.py to import utils.py from the same package.
2017-05-28 17:12:11 -07:00
Tim Abbott bd4be69148 contrib_bots: Fix python 3 lint errors. 2017-05-26 10:18:40 -07:00
Elliott Jin dd71daa09f bots: Add __init__.py so bot modules can be imported. 2017-05-25 15:00:51 -07:00
Tim Abbott 971fabe8ad bots: Simplify automated testing library. 2017-05-24 20:13:25 -07:00
derAnfaenger a85c7a0705 bots: Simplify define bot test. 2017-05-24 19:44:22 -07:00
derAnfaenger 9b67e94ba8 bots: Fix unit tests not running in Vagrant.
`test-bots` would not run in Vagrant, displaying
the error "ValueError: no such test method in <class
'bots_test_lib.BotTestCase'>: runTest" This was due to
the `BotTestCase` class inheriting from the TestCase
class, even though it was not a unit test on its own.

This commit removes the inheritance of TestCase and
specifies `test_define` as the `runTest` method in
`TestDefineBot`.
2017-05-24 19:44:22 -07:00
Krzysztof Krzysztof 073468ebba bots: Add empty message support in Wikipedia bot. 2017-05-24 19:23:36 -07:00
derAnfaenger e59b9ed897 bots: Make run.py independent from current working path. 2017-05-24 17:34:11 -07:00
Krzysztof Krzysztof 12e81fd024 bots: Add empty message support in Wikipedia bot. 2017-05-24 14:49:57 -07:00
derAnfaenger c6d294385f bots: Refactor bots to use send_reply.
The send_reply function makes it easier for bots
to send messages. This commit updates all bots to
make use of this function, when possible.
2017-05-24 13:16:23 -07:00
Abhijeet Kaur f83ddd658c tests: Add contrib_bots/test-bots file.
This test uses unittest and mock library. It mocks
'BotHandlerApi' class. This test works independent of
the rest of the code outside contrib_bots folder.

Merged with a few changes by tabbott to fix lint issues; we'll need to
do further work on this framework, but since it's not hooked up to
anything, it's reasonable to merge early so others can collaborate on
improving it.
2017-05-24 13:13:03 -07:00
Krzysztof Krzysztof b540c09768 bots: Correct weird behavior of followup bot for empty messages.
Before it sends an empty message to followup stream, now it sends a
help message back to the user/stream where it was mentioned.
2017-05-24 11:58:12 -07:00
derAnfaenger 854416b725 bots: Add incrementor bot.
This bot provides a sample implementation
for updating existing messages sent by the
bot.
2017-05-24 11:01:47 -07:00
Tim Abbott bfb4ec78cc contrib_bots: Fix lint errors in virtual_fs.py. 2017-05-23 21:35:09 -07:00
neiljp 194ba1367b contrib_bots: Clean up and document virtual_fs bot. 2017-05-23 21:04:34 -07:00
Theodore Chen a8b825388d bots: Fix googlesearch bot exceptions and add readme. 2017-05-23 20:18:24 -07:00
derAnfaenger bb70c5beed bots: Fix converter bot.
The converter bot depended on past.utils.old_div,
which is not supported anymore. Updating the code
to use the // operator, which provides the same
functionality.
2017-05-23 20:13:29 -07:00
neiljp adb5f645bc contrib_bots: Update xkcd bot to use send_reply.
This enables private message usage.
2017-05-23 18:43:43 -07:00
neiljp 915d98aa68 contrib_bots: Remove triage_message() from help bot.
This completes removing triage_message from the tree.
2017-05-23 18:30:39 -07:00
neiljp ec0de2a7ff contrib_bots: Switch encrypt bot to use send_reply. 2017-05-23 17:32:51 -07:00
neiljp 9c637db2ec bots: Switch define bot to use send_reply. 2017-05-23 17:02:03 -07:00
neiljp 0606d7acad bots: Fix help bot replies in private chat, including 3+ users.
Also deduplicates the code.
2017-05-23 14:38:49 -07:00
Theodore Chen 9604ffca38 bots: Add helloworld example bot. 2017-05-23 13:15:21 -07:00
neiljp bd37161ece Factor out send_reply functionality into bot_lib 2017-05-23 12:40:08 -07:00
neiljp ad25f27853 Update Wikipedia bot to reply to multiple user private chats. 2017-05-23 08:17:35 -07:00
Aditya Bansal 950101651d pep8: Add compliance with rule E261 to bots/define/define.py. 2017-05-07 23:21:50 -07:00
Yago González 1894a134f8 bots: Move Google search bot and fix bugs.
Now this bot follows our latest structure for contrib_bots.

Switched the dependencies instructions, to install "google" rather than
"google-api-python-client".

Added all the search terms to the query (not only the first one).
2017-03-17 13:03:06 -07:00
Abhijeet Kaur 1b31a16d13 contrib bots: Better error handling response in thesaurus. 2017-03-14 13:29:19 -07:00
Abhijeet Kaur 050162592a contrib bots: john bot can reply back in the same chat.
No need to create an extra "VirtualHelp" stream.
2017-03-14 13:29:19 -07:00
Abhijeet Kaur 92d2981726 contrib bots: Edit code for uniformity.
Add one function (get_bot_botname_response()) that generates response
from the given input and replies back to the handle_message with the final
content of response to be sent. Also add code to bots(except followup) to
reply to private messages along with stream messages.
2017-03-14 13:29:19 -07:00
Abhijeet Kaur d715787170 contrib bots: Rename bots to follow a consistent pattern.
Files renamed with few changes to accomodate the change in
path name of files. Fix few "at-mention bot" errors in docs.
2017-03-14 13:29:19 -07:00
Abhijeet Kaur 6dda0eb506 contrib bots: Rename bots to follow a consistent pattern.
Files renamed without any changes.
2017-03-14 13:29:19 -07:00
Umair Khan e749ff8c92 capitalization: Fix API Key in documentation. 2017-03-08 23:36:36 -08:00
Abhijeet Kaur 7c3a228450 doc updates: Remove triage_message function from contrib-bots. 2017-03-07 22:23:11 -08:00
Abhijeet Kaur 9a8dc7c622 Remove triage_message() function from all the contrib-bots.
To make all bots consistent add shared function in bot_lib.py
to check if this bot is called. All bots respond to at-mention of
the bot instead of their specific names.
2017-02-17 06:51:48 -08:00