Commit graph

498 commits

Author SHA1 Message Date
neiljp (Neil Pilgrim) 7910d8767a Bots: Adjust Incrementor bot to use StateHandler 2017-07-03 09:50:14 -07:00
Rohitt Vashishtha 2645c97276 bots: Add dependencies management.
Adds the file api/bots_api/provision.py that installs dependencies
for bots using pip. This file is also used by run.py when running
a bot. However, for testing, you need to separately provision the bots.
2017-06-28 12:00:13 -04:00
Rohitt Vashishtha b475258446 bots: Add tests for github_detail bot. 2017-06-22 11:25:31 -04:00
Rohitt Vashishtha b8b38bb1f7 bots: Fix github details bot. 2017-06-22 11:25:31 -04:00
Rohitt Vashishtha 9505778538 bots: Move github issue bot to api/bots. 2017-06-22 11:25:31 -04:00
Rohitt Vashishtha ea3dd2bd87 bots: Add HTTP status code support to mock http conversations. 2017-06-21 16:43:58 -04:00
Abhijeet Kaur 22cd8a1e7f bots: Remove unnecessary comment from test_giphy file.
This comment was added to explain the functionality of the
method called below it. Some changes in the method have led this
comment to be unnecessary.
2017-06-21 10:22:53 -04:00
Robert Hönig fcfda08f4d bots: Update yoda bot to use get_config_info(). 2017-06-19 07:11:08 -04:00
Robert Hönig ff015cf7b6 bots: Update weather bot to use get_config_info(). 2017-06-19 07:11:08 -04:00
Robert Hönig a10ee59853 bots: Update foursquare bot to use get_config_info(). 2017-06-19 07:11:08 -04:00
Robert Hönig c4a85b2f74 bots: Update commute bot to use get_config_info(). 2017-06-19 07:11:08 -04:00
Robert Hönig 4ce5521516 bots: tests: Remove superfluous sys.path insertion. 2017-06-19 07:11:08 -04:00
Robert Hönig 6e44c1bb88 bots: Check existance of config file in get_config_info(). 2017-06-15 02:17:31 -07:00
Robert Hönig 84c1827291 bots: Test get_config_info with giphy bot.
This involves both using the new `initialize`
method for calling `get_config_info`, and
refactoring the testing framework by adding a
way for mocking this method.
2017-06-14 20:25:07 -07:00
Robert Hönig fcb4cf6721 bots: Rename BotHandlerApi object client to bot_handler. 2017-06-13 11:13:23 -07:00
Robert Hönig c193443541 bots: Move mock http conversations to fixtures. 2017-06-13 09:22:35 -07:00
Robert Hönig 01c363317e bots: tests: Move http mock to context manager.
This commit decouples the http mock conversation
feature from assert_bot_response(), and moves it
to the context manager mock_http_conversation().
This allows a modular design with context managers
that could be added for assert_bot_response().
2017-06-09 05:25:17 -05:00
Tim Abbott 36329662d0 bots: Add missing __init__.py files. 2017-06-08 09:18:24 -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
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
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
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
Reid Barton 3dda07bad0 bots: Move zephyr-related files to api/integrations/zephyr/. 2017-05-26 15:07:02 -07:00
Reid Barton f0beaa3f1e bots: Move IRC and Jabber mirror scripts to api/integrations.
This is part of cleaning out the old bots/ top level directory.
2017-05-26 15:04:55 -07:00
Reid Barton caf3ec3ca1 bots: Remove githook-post-receive link.
Based on commits cdedb8593 and 58a8934a8 it seems to be unused.
2017-05-25 18:05:35 -07:00
umkay 5252626095 mypy: Change type annotation to Set[bytes].
also fix unicode
2017-05-23 10:42:44 -07:00
Jordan Gedney f124531a88 mypy: Add type: ignores for optparse.OptionGroup.
Typeshed has already fixed this upstream (Description is optional)
2017-05-22 14:40:48 -07:00
umkay b404fb3672 mypy: Change type annotation from union to explicit set 2017-05-22 13:47:55 -07:00
Tim Abbott 53af52fd69 zephyr_mirror: Include URL for mirroring server. 2017-05-10 11:54:09 -07:00
Tim Abbott b426870a30 zephyr_mirror: Fix buggy zephyr_mirror_backend import. 2017-05-10 11:52:34 -07:00
Tim Abbott 576c6f51f0 zmirror-renew-kerberos: Clean up hardcoding of user ID. 2017-05-10 11:52:34 -07:00
Tim Abbott fed5180d19 zephyr_mirror: Avoid transmitting null characters to server. 2017-05-10 11:52:34 -07:00
Tim Abbott 951c5588b6 zephyr_mirror: Add support for discuss-format messages. 2017-05-10 11:52:34 -07:00
Aditya Bansal 65a6460d6e pep8: Add compliance with rule E261 to zephyr_mirror_backend.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal ab3cbd313b pep8: Add compliance with rule E261 to summarize_stream.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal fbcfa6239a pep8: Add compliance with rule E261 to jabber_mirror_backend.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal c7fbe91ab6 pep8: Add compliance with rule E261 to irc-mirror.py. 2017-05-07 23:21:50 -07:00
Tim Abbott 3cf8d11156 zephyr_mirror: Simplify process for finding backend script. 2017-03-20 21:52:04 -07:00
Tim Abbott beb2a6570f sync_public_streams: Use option group for arguments. 2017-03-20 21:52:04 -07:00
Tim Abbott 362d7424ed check-mirror: Remove unnecessary zulip_user variable. 2017-03-20 21:52:04 -07:00
Tim Abbott fa6a8488dd check-mirroring: Remove api.zulip.com hardcoding. 2017-03-20 21:52:04 -07:00
Jacob Hurwitz baefa61edf [zephyr_mirror] add support for zcrypt'ed classes with colons
The regex used for parsing .crypt-table didn't allow colons in class
names. This commit changes the [^:] token with \S, meaning that class
names can now contain colons but can no longer contain whitespace.

I think this should be fine, since zcrypt is only used for MIT zephyr,
where (by convention) class names do not contain whitespace.

Additionally, it should not be possible for us to accidentally consume a
field-separating colon as part of the class capture group because the
regex enforces that all field-separating colons are followed by one or
more whitespace characters, whereas the class name cannot contain
whitespace.
2017-03-19 22:30:21 -07:00
Tim Abbott fa67e87d3d mypy: Fix some new errors flagged by latest mypy master.
Mostly list -> List bugs in annotations.
2017-03-19 21:03:45 -07:00
sinwar 04580dbb97 python: Fix remaining bare excepts in codebase.
Fixes #2862.
2017-03-05 16:17:04 -08:00
Raghav Jajodia 58f5e729b6 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00