Commit Graph

670 Commits

Author SHA1 Message Date
Tim Abbott 202f01b06c test-bots: Fail if a bot is missing __init__.py. 2017-06-08 09:21:12 -07:00
neiljp 68c6389fa6 Switch back to single suite of tests & add --exclude option 2017-06-08 09:18:24 -07:00
Tim Abbott ddcc1d3c2b bots: Add missing __init__.py files. 2017-06-08 09:18:24 -07:00
Tim Abbott d3df4307d3 test-bots: Fix lint errors. 2017-06-07 14:02:27 -07:00
derAnfaenger 9e3e2c56ce 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 130c79d4d8 test-bots: Enable list of bots to test & check for valid bot names. 2017-06-06 22:29:57 -07:00
Tim Abbott d18e0bcdca log2zulip: Fix paths to the rest of the project. 2017-06-05 23:48:31 -07:00
Abhijeet Kaur 46883c5c0d 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 96c75db558 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 bcc4ced413 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 0b746c5df4 pep8: Add compliance with rule E261 bots_test_lib.py. 2017-06-04 09:18:22 -07:00
Aditya Bansal e3cf43399f pep8: Add compliance with rule E261 send.py. 2017-06-04 15:05:34 +05:30
Aditya Bansal d2c215afde pep8: Add compliance with rule E261 zephyr_mirror_backend.py. 2017-06-04 15:05:22 +05:30
Aditya Bansal cf9725836c pep8: Add compliance with rule E261 rss-bot. 2017-06-04 15:02:31 +05:30
Aditya Bansal 880314e45e pep8: Add compliance with rule E261 jabber_mirror_backend.py. 2017-06-04 15:01:39 +05:30
Aditya Bansal 02b855a389 pep8: Add compliance with rule E261 test-bots. 2017-06-04 15:00:58 +05:30
Aditya Bansal 8d06b5d9d9 pep8: Add compliance with rule E261 bot_lib.py. 2017-06-04 15:00:42 +05:30
Aditya Bansal f0b1a6c8d2 pep8: Add compliance with rule E261 virtual_fs.py. 2017-06-04 14:58:37 +05:30
Abhijeet Kaur f320ff11f7 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 72b877c7de 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 db9918f3d6 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 9814bd77cc pep8: Add compliance with rule E261 google/google-calendar. 2017-05-31 17:07:15 -07:00
Aditya Bansal cc9e08bf87 pep8: Add compliance with rule E261 to bots/check-mirroring. 2017-05-31 17:07:15 -07:00
Aditya Bansal 3c50019001 pep8: Add compliance with rule E261 to api/integrations/rss/rss-bot. 2017-05-31 17:07:15 -07:00
Aditya Bansal 5b6a21c100 pep8: Add compliance with rule E261 to api/examples/upload-file. 2017-05-31 17:07:15 -07:00
Eeshan Garg fc6125ec2e 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 ea131936d6 api/setup.py: Upgrade to Beta and update homepage URL. 2017-05-30 22:25:14 -07:00
Eeshan Garg 99c2e1875d api: Increase the version from 0.2.5 to 0.3.0. 2017-05-29 20:09:59 -07:00
Eeshan Garg debe9fa9dc api: If there is no $HOME, assume .zuliprc doesn't exist. 2017-05-29 20:09:57 -07:00
Tim Abbott ce26f0e086 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
Tim Abbott c5bc1265f3 bots: Move log2zulip into api/integrations. 2017-05-26 15:15:56 -07:00
Reid Barton ccb4c5c26f bots: Move zephyr-related files to api/integrations/zephyr/. 2017-05-26 15:07:02 -07:00
Reid Barton 2f21290407 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 461856dd56 rss-bot: Add --unwrap, --math options.
These are for processing arXiv API results.
2017-05-25 16:24:07 -07:00
Eeshan Garg 3843f191b4 api: Use the console_scripts entry point to point to zulip-send.
Instead of using the `scripts` keyword, we now use the
`console_scripts` entry point to point to the zulip-send script
to be installed. This is what the Python Packaging User Guide
recommends for better cross-platform compatibility.
2017-05-22 18:08:18 -07:00
Jordan Gedney 36406b6a25 mypy: Add type: ignores for optparse.OptionGroup.
Typeshed has already fixed this upstream (Description is optional)
2017-05-22 14:40:48 -07:00
Jordan Gedney 2c21c26b50 mypy: PySvn Client.Log returns a dictionary mapping to many different types. 2017-05-22 14:39:26 -07:00
Tomasz Kolek 61d5d41067 Add Slack importer bot. 2017-05-09 10:48:08 -07:00
Aditya Bansal b642696e5d pep8: Add compliance with rule E261 to api/zulip/__init__.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal 4ebcbfadd7 pep8: Add compliance with rule E261 to api/setup.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal 1efb2cbc7f pep8: Add compliance with rule E261 to zulip_openshift_config.py. 2017-05-07 23:21:50 -07:00
Eeshan Garg b8f71c5d24 Document how to set up an Asana integration via Zapier.
Fixes #3948.
2017-03-21 19:56:47 -07:00
derAnfaenger 0047dbaa24 Replace native datetimes in the Codebase integration.
Update all utcnow() and now() calls, as well as other native dates to
specify the UTC timezone.
Fixes #3809.
2017-03-08 15:32:06 -08:00
sinwar 6f0564e9f4 python: Fix remaining bare excepts in codebase.
Fixes #2862.
2017-03-05 16:17:04 -08:00
Raghav Jajodia a3a03bd6a5 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Rishi Gupta 28d3af0965 Fix several new errors caught by mypy 0.501.
Clear out a bunch of easy to review errors, so we can focus on the more
complicated ones.
2017-03-03 14:12:52 -08:00
Elliott Jin 2ea0430bf1 Clean up timestamp formatting in Google Calendar bot. 2017-02-28 09:29:07 -08:00
Elliott Jin be57d49beb Google Calendar bot: Populate events array directly. 2017-02-26 18:05:46 -08:00
Elliott Jin 31d777a138 Google Calendar bot: Include time zone offsets in timestamps.
Fixes: #3769
2017-02-26 18:05:46 -08:00
Tim Abbott 32bfebeb7a mypy: Fix inconsistencies in use of *args/**kwargs. 2017-02-18 18:39:44 -08:00