Commit graph

1172 commits

Author SHA1 Message Date
Tim Abbott 1c1286824f provision: Use sys.version_info for Python version. 2017-08-24 12:38:20 -07:00
Tim Abbott ed774fafcb provision: Fix usage to not have line-wrapping issues. 2017-08-24 12:38:14 -07:00
derAnfaenger 0984eae9b5 provision: Rewrite in Python. 2017-08-24 12:32:55 -07:00
Tim Abbott 5bc98bfdf7 send_message: Remove unnecessary API key details.
This removes a lot of clutter from this example.

This is the send_message part of #1.
2017-08-24 10:58:29 -07:00
Alex Dehnert 5eaac7bfba api: Use requests.Session.
Using requests.Session allows the requests library to reuse HTTP
connections, which is potentially helpful for performance.

Fixes #3.
2017-08-24 10:39:42 -07:00
neiljp (Neil Pilgrim) 749356d34b Incrementor tests: Preliminary coverage with no update_message support. 2017-08-24 10:24:41 -07:00
neiljp (Neil Pilgrim) d8c4242053 VirtualFS tests: Improve test coverage. 2017-08-24 10:24:41 -07:00
neiljp (Neil Pilgrim) 37206db176 TicTacToe tests: Improve test coverage. 2017-08-24 10:24:41 -07:00
derAnfaenger b3fc7edcf7 git: Ignore automatically generated MANIFEST.in. 2017-08-24 10:01:53 -07:00
Tim Abbott d42fa61dee test_lib: Clean up variable names. 2017-08-23 19:06:30 -07:00
neiljp (Neil Pilgrim) bef80129bd bot testing: Set check_expected_responses to test one source at a time.
When testing bots with state and using type="all", it is expected that
the passed-in state will be applied for each source individually.
This commit moves away from alternating between sources for each test,
to running all the tests on each source with a copy of state_handler.
2017-08-23 19:00:33 -07:00
neiljp (Neil Pilgrim) 2bd81eaff1 bot testing: Allow check_expected_responses to take Sequence[Tuple].
Ordered data is required for logical testing of stateful bots, as
compared to the previous use of a dict.
2017-08-23 19:00:33 -07:00
derAnfaenger 3e4d1fc02e requirements: Add coverage. 2017-08-23 16:41:02 +02:00
derAnfaenger cb017f22f7 travis: Simplify installation process. 2017-08-23 16:40:38 +02:00
derAnfaenger 81e6b01300 testing: Add build and coverage badges to README.md 2017-08-23 10:00:38 +02:00
Tim Abbott 9c18c0b4ed twitter: Fix buggy handling of config_file in Python 3.
This fixes the most broken part of #88.
2017-08-22 17:20:54 -07:00
Ahmad Jarara 409bb58742 api: set event_types to empty list if not supplied in register.
Previously, if you didn't specify a list of `event_types` in either `register` or `call_on_each_event`, you'd get an exception due to the invalid event format.

This fixes #86.
2017-08-22 16:33:10 -07:00
Abhijeet Kaur 83bfcb6535 bots: Modify is_private function to take 'id' as parameter.
This is done so that Embedded bot system can also make use of
this function directly, as only id is needed in this function.

Tweaked by tabbott to have a cleaner interface and simpler
documentation.
2017-08-22 12:03:09 -07:00
Abhijeet Kaur ae434cd26c bots: Use user 'id' instead of 'name' in is_private function.
Names are not guaranteed to be unique, user ids should
be used when comparing if the sender and receiver are the same.
2017-08-22 11:59:11 -07:00
derAnfaenger 735943379f provision: Add option to specify python version. 2017-08-22 11:39:11 -07:00
derAnfaenger a4d6c4700f provision: Refactor script variables and Windows support. 2017-08-22 11:39:11 -07:00
derAnfaenger 095cea7ab9 codecov: Document line capture issue in code. 2017-08-22 11:42:57 +02:00
derAnfaenger a5708e4dde testing: Add code test coverage reporting.
Fixes #38.
2017-08-21 15:03:47 -07:00
derAnfaenger 95021ebd56 testing: Add script for executing zulip_botserver tests. 2017-08-21 15:03:47 -07:00
derAnfaenger f5d01826f2 travis: Split test jobs into two files. 2017-08-21 15:03:47 -07:00
Tim Abbott e1758945de bots: Extract some functions to top-level.
We'll want to use these functions for the embedded bots system.
2017-08-17 10:53:39 -07:00
Tim Abbott 0eecf05226 provision: Fix detection of Windows. 2017-08-17 10:47:49 -07:00
Tim Abbott 2f7968e860 provision: Use 'cp -a' for copying requirements.txt.
It's generally best to preserve the metadata when copying files.
2017-08-17 10:47:00 -07:00
Tim Abbott 5e4c65f325 provision: Print out the command needed to activate venv. 2017-08-17 10:46:36 -07:00
Tim Abbott a744fd9316 provision: Fix shell quoting and whitespace. 2017-08-17 10:43:50 -07:00
Rohitt Vashishtha 3b95af3b63 tools: Add virtual-env path exception for CygWin. 2017-08-17 10:43:50 -07:00
Rohitt Vashishtha 4cd580d4fe tools: Diff with requirements.txt in tools/provision. 2017-08-17 10:43:50 -07:00
Eeshan Garg dcaace2a88 README: Add instructions for setting up a development environment. 2017-08-17 10:43:23 -07:00
Eeshan Garg f2687056b4 README: Add links to zulip_bots, zulip_botserver packages. 2017-08-17 10:39:00 -07:00
Eeshan Garg f9655266df python-zulip-api: Add tools/provision for setting up dev env. 2017-08-17 10:39:00 -07:00
derAnfaenger e4c34d77e7 packaging: Automatically generate zulip_bots MANIFEST.in.
Fixes #69.
2017-08-17 10:09:24 -07:00
derAnfaenger e1d1c490c8 Split too long line in server_lib/README.md. 2017-08-17 10:06:31 -07:00
derAnfaenger 14ebc24f59 travis: Move linter to a separate job. 2017-08-17 10:06:31 -07:00
Eeshan Garg 7460aca3e5 zulip_bots: Format string before checking if logo file exists.
get_bot_logo_path now first formats the path string with the name
of the bot before checking if the path exists. Not doing so is a
bug and causes the function to always return None.
2017-08-16 17:18:06 -07:00
Eeshan Garg c61d413f25 zulip_bots: Remove thesaurus bot.
This bot depends on PyDictionary, which isn't very well-implemented
or well-maintained. PyDictionary's dependency on goslate and
goslate's dependency on concurrent.futures has been known to cause
problems in Python 3 virtualenvs. This bot has also been the
source of disruptive BeautifulSoup warnings. Since this bot is only
meant to be an example bot, and for all the above reasons,
it makes sense to remove this bot. The cons of debugging the above
issues outweight the pros of having the bot at all.
2017-08-16 16:54:24 -07:00
derAnfaenger bcc1489bc5 testing: Make linter fail with exit code if any check fails. 2017-08-16 07:46:09 -07:00
derAnfaenger 708cf27e8d travis: Test against Python 3.4, 3.5, and 3.6.
Fixes #44.
2017-08-16 07:00:29 -07:00
Eeshan Garg a28fcbbaa9 zulip_bots: Add script to generate zulip_bots/MANIFEST.in.
As a package maintainer, I have to exclude the test fixtures in
MANIFEST.in so that they aren't shipped with the package release.
But for the repo, we need to include fixtures, logos and docs so
that Travis can run the tests after running
`pip install ./zulip_bots`.

Also, since we are installing zulip_bots off of this repo in our
main repo, docs and logos should be included so that they can be
rendered alongside our webhooks/integrations documentation, so we
need to include them in MANIFEST.in as well.

To automate this process, I just wrote this handy little script
that future bot contributors can run instead of having to manually
specify what to include in MANIFEST.in in the repo.
2017-08-15 19:30:13 -07:00
Eeshan Garg be87c04a8e zulip_bots: Include yoda fixtures in MANIFEST. 2017-08-15 19:30:13 -07:00
Eeshan Garg e0cafd1fdb zulip_bots: Add function to get path to a bot's doc.md file.
This is part of our efforts to have the documentation for a
particular bot live in this repo but still be able to render it
in the main repo (in a way similar to how we render the webhooks
docs).

This function allows us to specify the path to a bot's doc.md file
in zerver.lib.integrations.BotIntegration.
2017-08-15 19:30:13 -07:00
Eeshan Garg 5bb1cbf8d0 zulip_bots: Add logo for the GitHub Detail bot. 2017-08-15 19:30:13 -07:00
Eeshan Garg 1ca5ae5db8 zulip_bots: Add logo for the Google Search bot. 2017-08-15 19:30:13 -07:00
Eeshan Garg d63269ee6a zulip_bots: Rename bots/{bot}/readme.md -> bots/{bot}/doc.md.
doc.md better describes the style of documentation that will live
inside these files, since we want these to be similar to our
webhooks' doc.md files in terms of how these are rendered and
composed of Markdown macros.
2017-08-15 19:30:13 -07:00
Eeshan Garg aee564825f zulip_bots: Add function to get absolute path to the bots/ dir.
This is part of our efforts to have the documentation for a
particular bot live in this repo but still be able to render it
in the main repo (in a way similar to how we render the webhooks
docs).

This function allows the calling code to get the absolute path
to the bots/ directory. This will allow us to specify an
arbitrary path (jinja2.env.loader.searchpath)
to look for templates for bots' documentation.
2017-08-15 19:30:13 -07:00
Eeshan Garg 824000f32b zulip_bots: Add function to get the path to a bot's logo.
This is part of our efforts to have the documentation for a
particular bot live in this repo but still be able to render it
in the main repo (in a way similar to how we render the webhooks
docs).

For the logo, if a particular bot has a logo, get_bot_logo_path
expects to find it as /zulip_bots/bots/{bot_name}/logo.png or
/zulip_bots/bots/{bot_name}/logo.svg.
2017-08-15 19:30:13 -07:00