Robert Hönig
c745d1901c
bot_config.py: Add function for loading config file templates.
...
load_bot_config_template(bot) parses the <bot>.conf
template file, which can be found in the zulip_bots
package for each bot. It then returns the INI content
of that file as a dict.
2018-01-07 20:05:52 +01:00
Robert Hönig
ed7208fd6e
Make EmbeddedBotHandler.get_config_info comply with ExternalBotHandler.
2018-01-07 20:05:52 +01:00
Robert Hönig
9cc059f4aa
bot_config.py: Raise exception when getting config data from bot without config entries.
2018-01-07 20:05:52 +01:00
Robert Hönig
1e66bd1c02
tests: Add newlines to test_service_bot_system.test_internal_endpoint().
2017-11-27 21:05:34 -08:00
derAnfaenger
c8a5ae753c
embedded bots: Consistently use 'storage' instead of 'state.'
2017-11-27 21:05:34 -08:00
Robert Hönig
0e0a8a2b14
queue processor tests: Call consume by default.
...
This significantly improves the API for queue_json_publish to not be
overly focused on what the behavior of this function should be in our
unit tests.
2017-11-26 11:45:34 -08:00
Tim Abbott
6968b540c8
mypy: Remove type: ignores that are unnecessary with new mypy.
...
Mostly these can be removed because the broken LXML stubs were removed
from typeshed in https://github.com/python/typeshed/issues/525 .
2017-11-25 10:06:28 -08:00
derAnfaenger
e526d0c144
embedded bots: Add views to access state.
2017-11-21 21:10:39 -08:00
derAnfaenger
cbadd3d430
embedded bots: Simplify StateError exception messages.
2017-11-21 21:10:12 -08:00
rht
6c28c7e879
zerver/tests: Use python 3 syntax for typing.
2017-11-18 15:35:57 -08:00
derAnfaenger
395f1e9270
embedded bots: Add database config storage.
...
Storage limititations are only set on the value of
a config entry, since this is the only user-accessible
part of the schema. Keys are statically set by each
embedded bot.
2017-11-16 23:06:38 -08:00
rht
4f5b1c0a5a
zerver/tests: Use python 3 syntax for typing in most files.
2017-11-16 21:52:01 -08:00
derAnfaenger
25bf15a3c9
bots: Use non-generic exception for state key removal.
2017-11-10 18:56:26 -08:00
derAnfaenger
8fccf36246
bots: Wrap StateError exceptions around BotUserData exceptions.
2017-11-10 18:56:26 -08:00
derAnfaenger
d707e3bc1d
bots: Add USER_STATE_SIZE_LIMIT setting.
2017-11-10 18:56:26 -08:00
derAnfaenger
545c73c79e
bots: Rename StateHandlerError to StateError.
2017-11-10 18:54:54 -08:00
derAnfaenger
71372610e3
bots: Validate state size limit directly in set_bot_state().
2017-11-10 18:54:39 -08:00
derAnfaenger
6c543d1280
bots: Make StateHandler test more accurate.
2017-11-10 18:45:52 -08:00
derAnfaenger
2155b255d6
service bot tests: Remove bot stream subscription.
...
Since service bots react to all @-mentions, the
stream subscription was redundant.
2017-11-02 14:44:11 -07:00
Tim Abbott
c160c06f9c
bot_storage: Fix missing test coverage.
...
Apparently, we didn't have coverage on setting a second value for a
key.
2017-10-30 14:10:35 -07:00
Steve Howell
f264bbc7ca
tests: Fix send_message calls in test_service_bot_system.py.
2017-10-28 10:20:59 -07:00
Tim Abbott
fa55d7ed33
retry_event: Remove requirement of failed_tries being already there.
...
This fixes a bug where retries in the signups queue threw an exception.
2017-10-27 18:15:53 -07:00
Steve Howell
53dbcbe2a4
refactor: Handle service bot mentions earlier in the code.
...
We now find all (possibly) relevant service bots for a message
in the call to get_recipient_info. This allows us to eliminate
some code that would patch them after we rendered.
The get_service_bot_events() function will ignore any service
bots that weren't actually mentioned in the message (due to
backticks) or part of the active user ids.
2017-10-26 22:16:47 -07:00
derAnfaenger
17949adf11
embedded bots: Add StateHandler remove() function.
2017-10-26 14:49:50 -07:00
derAnfaenger
ce4ba9c178
bot services: Use call_consume_in_tests.
2017-10-25 15:56:12 -07:00
derAnfaenger
0d0c8fee7e
embedded bots: Migrate StateHandler API to use get and put.
...
This moves away from handling a StateHandler object like a dict
and gives it the methods get, put, and contains.
2017-10-25 15:39:28 -07:00
derAnfaenger
34e3eb8c67
embedded bots: Rename state and state_handler to storage.
2017-10-25 15:39:28 -07:00
derAnfaenger
cd600b8677
embedded bots: Add StateHandler marshaling functions.
2017-10-25 15:39:28 -07:00
derAnfaenger
2e51d39d69
embedded bots: Add StateHandler tests.
2017-10-19 13:09:23 -07:00
rht
26f5d9a32c
zerver/tests: Remove print_function.
2017-09-27 18:05:45 -07:00
Steve Howell
de0b47fd4e
Always notify service bots about stream mentions.
...
Before this change, we were only triggering service bots
for stream mentions when the bot was subscribed to the
stream.
2017-09-27 17:22:12 -07:00
rht
1e87a4b68c
zerver/tests: Remove absolute_import.
2017-09-27 10:00:39 -07:00
Steve Howell
b340b28055
Extract get_service_bot_events().
...
There are several reasons to extract this function:
* It's easy to unit test without extensive mocking.
* It will show up when we profile code.
* It is something that you can mostly ignore for
most messages.
The main reason to extract this, though, is that we are about
to do some fairly complex splicing of data for the use case
of mentioning service bots on streams they are not subscribed to,
and we want to localize the complexity.
2017-09-26 18:49:03 -07:00
Tim Abbott
eb720485c5
tests: Add and use new self.subscribe.
...
This new method cleans up the API for subscribing to something from a
test case.
2017-08-24 21:37:57 -07:00
Tim Abbott
80458945c7
tests: Remove unnecessary use of get_realm_by_email_domain.
...
That function was primarily intended for some limited registration
code paths, not the generic usage it was getting.
2017-08-24 20:22:56 -07:00
Elliott Jin
4907f24603
bots: Add additional service bot tests.
2017-05-25 15:00:51 -07:00
Elliott Jin
af49a23013
bots: Generalize service bot tests to also test embedded bots.
2017-05-25 15:00:51 -07:00
Elliott Jin
cd8c77bf91
bots: Clean up order and naming of service bot tests.
2017-05-25 15:00:51 -07:00
Elliott Jin
49adeee8c8
bots: Move service bot tests into separate file.
2017-05-25 15:00:51 -07:00