It is not guaranteed that the integration scripts in
the Zulip repository even specify a `provision` option.
Therefore, checking the value of this option would fail.
Updating this with getattr and a default value.
To do so, we need to import all required internal modules after the
script had the option to provision. The provisioning itself is then
done by zulip.init_from_options().
As the first unittest, this creates a test directory and
abnd adds it tho the excluded pip package files.
There are two `tests` directories now, one in zulip_botserver and one in
zulip. This confuses the unittest runner, leading to failed test imports.
Therefore, we need to tell the package importer that there are multiple
tests directories, all of which should be considered for a search.
Before this commit, codecov got installed for each test job,
but was only needed *after* all jobs had passed: in after_success.
This lead to codecov silently failing, as it was not installed when
it was actually needed.
I'm not thrilled with the `replace` error handler losing information
if the logfile contains invalid UTF-8 for some reason; but that sure
beats a UnicodeDecodeError, and for this script I can't quite be
bothered to run the rather tricky riddle trail that Python 3 makes it
to pass arbitrary byte data through layers of ordinary text processing.
If a user provides both the name and the path to the bot
as input then we either will have to chose one of them
or alert the user to check the input. Selecting the latter
by sending an error message to the user.
Very few bots like followup bot directly call 'send_message'
function from the bot code. Since ExternalBotHandler class is
mocked, we'll have to mock 'send_message' function as well.
Added dummy field value of 'sender_email' for the message to be
as followup bot requires that field while processing
the message.
Since send_message is directly called from a specific bot's code,
so it can be sent to a different stream or under a different topic
than that of the incoming message. So, print the entire message
along with stream name.
A bot calling 'send_reply' function will reply to the incoming
message in the same stream under the same topic. So, only printing
bot's response message content for that.
This eliminates the need to setup dev environment and to
create a bot, setup zuliprc file, subscribe the bot to the
stream in order to try out a bot.
Manual command get-bot-output gives the bots response content
directly.
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.