Commit graph

17 commits

Author SHA1 Message Date
neiljp (Neil Pilgrim)
6cdb83ce72 bot tests: Adjust TestCase inheritance to avoid need to skip/filter.
Previously the test-bots script filtered out base-class tests from
BotTestCase. With this change, BotTestCase continues to inherit from
unittest.TestCase, but the default test_* methods previously in this
class are now in a new DefaultTests class, which does not. Instead, each
bot needs to inherit from BotTestCase and DefaultTests *explicitly*.

This avoids the need to filter out the base-class tests, which
simplifies the test-bots script, and may ease any migration to eg.
pytest.

The DefaultTests class does require some non-implemented methods which
BotTestCase provides.
2018-06-09 12:49:49 -04:00
Eeshan Garg
246f065877 zulip_bots: Remove unnecessary requirements.txt files in /bots.
A lot of these were either empty or required 'requests', which
is already installed as part of the main 'zulip' package.
2018-06-04 19:59:59 -02:30
novokrest
5ad5e11587 link_shortener: Allow #% characters for shortening URL. 2018-05-15 09:12:40 -07:00
novokrest
e81942421e link_shortener: Print help when no links found. 2018-05-04 05:09:07 +05:30
novokrest
3db070b99e link_shortener: Migrate from goo.gl to bit.ly service.
Shorten URLs by using bit.ly service instead of goo.gl service.

Fixes #367
2018-05-04 05:09:07 +05:30
Dhruv Thakker
8e978a0845 link_shortner bot : Add test for bad requests.
(This module now has 100% coverage.)
2018-03-08 08:27:32 -05:00
Robert Hönig
fd51735bfc Add requirements.txt for each bot. 2018-01-06 16:39:52 +01:00
Robert Hönig
f4ee3d4009 Fix mypy errors. 2018-01-04 17:19:02 +01:00
Robert Hönig
c86e62a06a link_shortener bot: Quit on invalid API key. 2018-01-04 10:34:16 -05:00
Viraat Chandra
9ac0628452 zulip_bots: Add link to get API Key in Link Shortener Bot Documentation. 2017-12-30 17:41:31 +01:00
Viraat Chandra
6a089f2217 zulip_bots: Fixed failing tests for Link Shortener Bot.
This uses a custom test_bot_responds_to_empty_message()
implementation for the link_shortener bot, because it requires
mocking config info.
2017-12-30 17:41:31 +01:00
Viraat Chandra
db0e88a1b9 zulip_bots: Check API key on initialization for link_shortener bot. 2017-12-30 17:41:31 +01:00
Robert Hönig
b306324bfa zulip_bots: Make BotTestCase the only helper library.
Renames StubBotTestCase to BotTestCase and removes
legacy code for supporting both names.
2017-12-14 05:56:55 -05:00
neiljp (Neil Pilgrim)
d686a3b337 bots (minor): Simplify test_link_shortener.py further.
* Rename test names to be more descriptive.
* Inline messages/response test.
2017-12-12 13:57:55 -06:00
Marco Burstein
e9aa94f81c mypy: Add annotations for Link Shortener Bot.
Based on work started by @skunkmb.
2017-12-12 13:57:55 -06:00
neiljp (Neil Pilgrim)
c8824cb2e5 bots: Simplify test_link_shortener.py. 2017-12-10 14:04:00 -08:00
Skunk
29e22c2c0a bots: Create Link Shortener Bot.
Create Link Shortener Bot using the goo.gl Link Shortening API.

Link Shortener Bot can be mentioned in a conversation, and it will
respond with shortened, goo.gl links for every URL in the message.

For example,

 > @link_shortener_bot @johnsmith Check out this file:
 > https://github.com/zulip/python-zulip-api/blob/master/zulip_bots/

and Link Shortener Bot would respond

 > https://github.com/zulip/python-zulip-api/blob/master/zulip_bots/:
 > https://goo.gl/Mt5z3c

In order to use Link Shortener Bot, an API key for goo.gl must be set
in `link_shortener.conf` in the `link_shortener` folder.
2017-12-05 06:08:30 -08:00