Commit graph

1914 commits

Author SHA1 Message Date
neiljp 225328e3af Switch back to single suite of tests & add --exclude option 2017-06-08 09:18:24 -07:00
Tim Abbott 36329662d0 bots: Add missing __init__.py files. 2017-06-08 09:18:24 -07:00
Tim Abbott f94bfd6de4 test-bots: Fix lint errors. 2017-06-07 14:02:27 -07:00
derAnfaenger 8f2fc6069d bots: Refactor and simplify bot_test_lib.py.
This commit integrates the mock_test function in
check_expected_responses and makes this function usable
for simple tests only by not allowing mock http conversations.

assert_bot_response() is now used for single message-response pairs,
resolving potential issues with multiple messages and a single http
request-response pair.

The giphy bot test file is updated accordingly.
2017-06-06 23:06:40 -07:00
neiljp 894a816618 test-bots: Enable list of bots to test & check for valid bot names. 2017-06-06 22:29:57 -07:00
Tim Abbott 48632752c4 log2zulip: Fix paths to the rest of the project. 2017-06-05 23:48:31 -07:00
Abhijeet Kaur 709a2521a1 bots: Add test file for 'giphy' bot.
This bot replies with different gif for the same query
that is provided. Mocked a definite response from requests.get
function.
2017-06-05 15:11:46 -07:00
Tim Abbott d0e5447cd0 bots: Refactor bot testing library to still support un-mocked HTTP.
Several of our bots haven't been converted to have mock responses for
third-party APIs yet, and we may want that code path for with-network
testing anyway.
2017-06-05 15:11:46 -07:00
Abhijeet Kaur 919db13fa8 bots: Add mock test support for bots using internet services.
Mock requests.get function for bots relying on external services
which may return different results. 'http_response' is mocked to
check if the bots run well and to make the tests determinitic. The
code first checks if the http request corresponding to the http response
is called or not.

This commit renders test files of bots using the internet
(third party) services to Fail. As requests.get() is replaced
by our mock function.

Since we have not provided mock http response for bots like xkcd,
wikipedia, define etc. Their requests.get() function returns empty
message.
2017-06-05 15:11:24 -07:00
Aditya Bansal 72ddcc1902 pep8: Add compliance with rule E261 bots_test_lib.py. 2017-06-04 09:18:22 -07:00
Aditya Bansal dd4a488ee5 pep8: Add compliance with rule E261 send.py. 2017-06-04 15:05:34 +05:30
Aditya Bansal 93dfd0df1d pep8: Add compliance with rule E261 zephyr_mirror_backend.py. 2017-06-04 15:05:22 +05:30
Aditya Bansal 68587e8e28 pep8: Add compliance with rule E261 rss-bot. 2017-06-04 15:02:31 +05:30
Aditya Bansal 5bbf577b54 pep8: Add compliance with rule E261 jabber_mirror_backend.py. 2017-06-04 15:01:39 +05:30
Aditya Bansal dd50dc3a33 pep8: Add compliance with rule E261 test-bots. 2017-06-04 15:00:58 +05:30
Aditya Bansal 60e8943ed2 pep8: Add compliance with rule E261 bot_lib.py. 2017-06-04 15:00:42 +05:30
Aditya Bansal d6e8f49cc9 pep8: Add compliance with rule E261 virtual_fs.py. 2017-06-04 14:58:37 +05:30
Abhijeet Kaur ff077bf7f0 bots: Add tests for followup bot.
'followup' bot has different message handling behavior for
different messages.
For usual messages it calls 'send_message' function of
'BotHandlerApi' class.
For empty messages it calls 'send_reply' function of
'BotHandlerApi' class.
2017-06-02 17:24:41 -07:00
Abhijeet Kaur e857a97427 bots: Add mock test for 'send_message' function in 'bots_test_lib' file.
Since few bots directly call 'send_message' function of
'BotHandlerApi' class instead of calling 'send_reply' function
first, add 'mock_test_send_message' to check for 'send_message'
function.

All test_<bot>.py files now need to specify which function the bot
will be sending the response to, for each particular message.

Make 'test_virtual_fs.py' and 'test_thesaurus.py' test files
consistent with other bots.
2017-06-02 17:24:41 -07:00
Rohitt Vashishtha 894adb1e43 bots: Move contrib_bots to api/bots*.
This will make it convenient to include these bots in Zulip API
releases on pypi.

Fix #5009.
2017-06-01 12:31:54 -07:00
Aditya Bansal 7531c4fb26 pep8: Add compliance with rule E261 google/google-calendar. 2017-05-31 17:07:15 -07:00
Aditya Bansal f097cba50d pep8: Add compliance with rule E261 to bots/check-mirroring. 2017-05-31 17:07:15 -07:00
Aditya Bansal c76d065db2 pep8: Add compliance with rule E261 to api/integrations/rss/rss-bot. 2017-05-31 17:07:15 -07:00
Aditya Bansal b82abbffe6 pep8: Add compliance with rule E261 to api/examples/upload-file. 2017-05-31 17:07:15 -07:00
Eeshan Garg 4e0424e9ff api/setup.py: Upgrade the version to 0.3.1.
Apparently, PyPI is very strict about package file names. Once you
upload files for 0.3.0, and only wish to make minor changes and
re-release it as the same version, it doesn't let you and complains
about identical file names.
2017-05-30 22:25:14 -07:00
Eeshan Garg 25064cf5d6 api/setup.py: Upgrade to Beta and update homepage URL. 2017-05-30 22:25:14 -07:00
Abhijeet Kaur f33baacd02 Updates get_help() function in 'virtual_fs' bot.
Update example commands from calling by keyword 'fs'
(As was done previously) to calling by at-mention of
the bot.
Updates '/contrib_bots/bots/virtual_fs/virtual_fs.py' by
correcting instructions on how to call 'virtual_fs' bot.
2017-05-29 20:44:13 -07:00
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
Eeshan Garg 2063e5b3c4 api: Increase the version from 0.2.5 to 0.3.0. 2017-05-29 20:09:59 -07:00
Eeshan Garg 7f81f6b7e5 api: If there is no $HOME, assume .zuliprc doesn't exist. 2017-05-29 20:09:57 -07:00
Tim Abbott 55f4f16d7a integrations: Remove legacy basecamp integration.
Now that we have the webhook integration, there's no reason to
maintain the pre-webhook version.
2017-05-29 15:10:59 -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
Theodore Chen ab2dcb869d test-bots: Add support for testing a single bot. 2017-05-28 17:52:51 -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 5c18c75295 bots: Remove legacy bots/ directory. 2017-05-26 15:21:30 -07:00
Tim Abbott 0fd15bcd25 bots: Move log2zulip into api/integrations. 2017-05-26 15:15:56 -07:00
Tim Abbott 2025e01870 puppet: Remove obsolete zuliprc.nagios file.
This hasn't done anything for years.
2017-05-26 15:14:12 -07:00