Commit graph

484 commits

Author SHA1 Message Date
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
Rishi Gupta 6c47fa77b6 Use time.time() instead of datetime.now() to measure elapsed time.
Both because it is more idiomatic and because we will soon start enforcing
that all datetimes in Zulip are timezone aware.
2017-03-01 22:54:28 -08:00
Tim Abbott 722fc56534 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott 55e8d5f58d lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott 5b3d2c9100 lint: Clean up E241 PEP-8 rule. 2017-01-23 21:21:14 -08:00
Tim Abbott 07cdd69e42 lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
JefftheBest1 5e95dc3bdc Fixed typos with threshold. 2017-01-12 04:50:20 -08:00
Tommy Ip d5690c80c9 bots: Fix bare except clause. 2017-01-09 00:39:33 +00:00
Tommy Ip 6302f0d645 bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tommy Ip 39d7db40b3 bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tim Abbott b352dc85f0 bots: Move gcal-bot into official API release. 2016-12-30 12:01:31 -08:00
Tim Abbott adc678a3ab bots: Fix jabber_mirror_backend annotations.
mypy was super confused because the name "zulip" was both an import
and a global variable in the file.
2016-12-27 21:39:32 -08:00
Steve Howell 5ad39e3971 Remove mypy exemption for api/zulip/__init__.py.
This required instead exempting these files:

    bots/jabber_mirror_backend.py
    tools/deprecated/iframe-bot/show-last-messages

Turning on mypy for the API exposes issues in the annotations
of other files.
2016-12-21 11:22:42 -08:00
Tim Abbott 42eaabf203 bots: Remove obsolete tddium-notify-humbug. 2016-12-15 12:16:26 -08:00
Tim Abbott ca12fd8009 bots: Remove old zulip.com configuration files. 2016-12-15 09:39:32 -08:00