The GET /messages action has been recently implemented into our
bindings. Therefore this example has been superseded by get-messages,
which is capable of fetch messages in a more fine-grained way.
* Add pytest to requirements.txt
* Add pass-through option to run pytest in verbose mode
* Use various default pytest options
* Exclude merels bot for now
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.
We just moved the logic for installing bot dependencies from setup.py
to tools/provision. So bot dependencies are not automatically installed
anymore as a part of the base package. Now, if there is an import error
caused by missing dependency, we display a neat error message asking
the user to provision bot dependencies.
The bot provisioning code was breaking due to pip.main not being
a function anymore. Also, I don't think we should pass the --quiet
option here. I felt it was good to have some visual information
about what deps were being installed, just in case if something
went wrong and there was a conflict, the user should be able to
see it.
Remove unReachable `elif` branch from `dbx_command`
method with checking whether the command is equal
to `help` because this check is performed
at the beginning of the method.
A lot of these bot dependencies are pretty hefty and shouldn't be
installed as part of the zulip_bots package. So the installation of
these belongs in tools/provision, not in setup.py.
Previously, when a user tried to run the Botserver with a
zuliprc but forgot to set the bot name, they were told to
edit the botserverrc file. However, the recommended approach
is to specify the botname with the -b option. This commit
adds an error message specific for this case. It recognizes
zuliprc files by their section header `api`.
Previously, when a bot name wasn't found, the Botserver threw
an ImportError with an error message. This results in an
intimidating traceback which is in most cases not helpful to
the user. This commit replaces the ImportError with sys.exit.
Previously, the responses set in bot test fixtures
where handled as JSON objects. This works fine for
most bot tests, because most of the APIs that bots
are calling return a JSON-formatted response object.
However, some, like Trello, do return raw data.
This hasn't been noticed so far, because the respective
Trello test needed internet access. Tests shouldn't
need internet access.
This commit makes that Trello test use a fixture. To
work properly, it also adds a way to make http_mock_config
parse the response object as raw data.
This can now be done by modifying the "is_raw_response"
property in a newly introduced "meta" object that can
be used to specify how a fixture should be handled.
Change checking auth_token in `initialize` method by calling
request to get user's information instead of calling POST request
which modifies progress of user's goal.