Commit graph

1994 commits

Author SHA1 Message Date
novokrest 5eef519b3b giphy: Add test for connection error during config validation. 2018-07-01 08:02:59 -04:00
Shubham Dhama 918e63a220 zulip_bots: Fix get_storage request arguments in StateHandler. 2018-07-01 08:01:18 -04:00
Shubham Dhama 88b649d689 test_lib: Fix repeated name of test_state_handler. 2018-07-01 08:01:18 -04:00
novokrest 7fc1ff5e0e bots: Add bot for uploading files to Zulip server.
Add file_uploader bot as an example of using
ExternalBotHandler's methods for uploading files
to Zulip server.
2018-07-01 07:57:45 -04:00
novokrest e5239c5c54 lib: Add ExternalBotHandler methods for file uploading.
Add methods ExternalBotHandler.upload_file() and
ExternalBotHandler.upload_file_from_path() for uploading
local files to Zulip server.

Fixes #351
2018-07-01 07:57:45 -04:00
novokrest 935701aea2 flock: Add test for connection error during message sending. 2018-07-01 07:55:36 -04:00
novokrest 0fec20239d flock: Fix error message for invalid user. 2018-07-01 07:55:36 -04:00
novokrest 7b3c083ab5 flock: Refactor test_no_recipient_found test to increase coverage. 2018-07-01 07:55:36 -04:00
novokrest 80adce3cee flock: Change name of var res to users in get_recipient_id method. 2018-07-01 07:55:36 -04:00
novokrest 7fe37dbfe8 flock: Move calling requests to flock's urls to separate method.
Introduce `make_flock_request()` method to make requests to flock's URLs.
2018-07-01 07:55:36 -04:00
novokrest efdc96929f flock: Change returned type of get_recipient_id to tuple (userId, error). 2018-07-01 07:55:36 -04:00
novokrest c2a3d4c517 flock: Rename method find_recipient to find_recipient_id. 2018-07-01 07:55:36 -04:00
novokrest 0a7a06f028 flock: Rename local var to to recipient_name in find_recipient method. 2018-07-01 07:55:36 -04:00
novokrest d24e4fc5c8 flock: Pass recipient's name as first argument in get_recipient_id method. 2018-07-01 07:55:36 -04:00
novokrest 5c46a4e68e flock: Rename local var to to recipient_id in get_flock_response(). 2018-07-01 07:55:36 -04:00
novokrest a17bd77b71 jira: Build request's data as dictionary to create/edit issues.
Build data in `make_create_json` and `make_edit_json` methods
as dictionary to send as JSON payload.
2018-07-01 07:54:28 -04:00
novokrest 24a157cd37 jira: Refactor old tests to use mock_http_conversation. 2018-07-01 07:54:28 -04:00
novokrest 6332ce47cb jira: Add tests for error cases and help command. 2018-07-01 07:54:28 -04:00
novokrest 914583e8f7 request_test_lib: Add mocking PUT requests. 2018-07-01 07:54:28 -04:00
Yago González f8fd7b6fbf api: Implement GET /messages/<message_id>/history. 2018-06-28 20:26:06 -02:30
Yago González 2da831bbe1 api: Fix mypy annotations for delete_message. 2018-06-28 20:26:06 -02:30
neiljp (Neil Pilgrim) 4e0dccc9f5 test-bots: Make bots_to_test a set, ensuring tests are not duplicated.
The previous style was causing duplicate tests for the dropbox_share bot
for the unittest runner, due to globbing of test_*.py giving duplicates.

However, it also avoids unintentional duplication of bot names to test
on the command line being tested multiple times, though again only with
the unittest runner.
2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) 2895853938 test-main: Pass command-line arguments to each script.
This allows use of:
  -p : Run all tests with pytest
  -v : Additionally run pytest results in verbose mode
2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) d01f9c08ea .gitignore: Add .pytest_cache folders. 2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) de5fa0e8fc test_handler: Add title for test sections which use test_handler. 2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) 2fd9162030 test-lib: Drastically simplify by using test_handler function.
This automatically enables use of the pytest runner using common code.
2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) 52ab8cc44e test_handler: Separate test title from path to discover tests. 2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) a6a5da2653 test_handler: Support running various tests using pytest.
This enables use of pytest with:
* the zulip package
* the botserver package
2018-06-28 14:55:23 -04:00
Kishan Patel ea370031ee tictactoe: Add tests for TicTacToeModel functions.
Encountered several issues with test cases initially,
where test cases were failing due to the structure of the tests
within the file. This was circumvented by creating a separate
instance of the class TicTacToeModel for each test case
in order to focus on unit testing. There might be an issue with
the _get_game_handlers() function at the end of the file
which is used to obtain the model and message information,
it seems to be getting the entire class TicTacToeModel instead of
creating an instance of the class. Overall, this commit focuses
on creating a precedent for writing test cases involving TicTacToeModel,
and implements basic cases which can be extended to larger
edge cases in the future. Testing was done locally by running
./tools/test-bots until we were able to get the response 'ok' for
all the test cases written. We also used coverage in order to test the
coverage of the cases. While we were not able to increase
the coverage as much as we would have liked, we were able to
identify several issues and fix them, hopefully making it easier
for future contributors to add additional test cases to TicTacToeModel.
Overall, we would like special attention given to the way
that TicTacToeModel() was initailized in these tests and whether or not
this is a scalable precedent for future tests.

Fixes: #122
2018-06-28 14:43:29 -04:00
Yago González e6972bcbb9 api: Add extra arguments to get-messages example. 2018-06-26 19:46:22 -02:30
Yago González 0e39ca5236 api: Remove recent-messages example.
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.
2018-06-26 19:46:22 -02:30
Yago González 38f3e1a9f5 api: Implement GET /messages/<message_id>. 2018-06-26 19:42:49 -02:30
Yago González e2f379675b api: Implement DELETE /messages/<message_id>. 2018-06-26 19:40:27 -02:30
Yago González 005829192e api: Implement PATCH /streams/<stream_id>. 2018-06-26 19:38:44 -02:30
novokrest aa6afbd2fe front: Add helper func to test command's error. 2018-06-25 08:14:14 -04:00
novokrest 0d3189b3b0 front: Fix status and body of response in fixtures for successful requests. 2018-06-25 08:14:14 -04:00
novokrest 100d50411f front: Add tests when command's request was failed. 2018-06-25 08:14:14 -04:00
Sivagiri Visakan 3e20593da2 bots/finder: Make name a non-default parameter in import_module_from_source. 2018-06-22 07:59:56 -04:00
Sivagiri Visakan 09a7894a34 bots: Extract path resolution logic into a function. 2018-06-22 07:59:56 -04:00
Sivagiri Visakan d053528925 bots: Move import_module_from_source to finder.py. 2018-06-22 07:59:56 -04:00
Yago González 36566c26c1 api: Implement GET /messages. 2018-06-21 15:51:53 -02:30
Rhea Parekh b28cfcac3d bots: Improve response at 3 wrong answers in trivia bot. 2018-06-12 13:00:43 -04:00
Rhea Parekh f25772d1dc bots: Increase test coverage for trivia_quiz bot. 2018-06-11 20:01:41 -04:00
Rhea Parekh 7e8deac8e0 bots: Add type annotations for trivia_quiz bot. 2018-06-11 20:01:41 -04:00
Rhea Parekh ba98220d44 bots: minor cleanup for trivia_quiz bot. 2018-06-11 20:01:41 -04:00
neiljp (Neil Pilgrim) 0ea49c96ed bot tests: import patch in incrementor & monkeytestit as in other tests.
This makes the code more compact and consistent.
2018-06-11 08:16:43 -04:00
neiljp (Neil Pilgrim) cd76a3cf5a mypy: Improve typing of dialogflow and salesforce tests. 2018-06-11 08:16:43 -04:00
neiljp (Neil Pilgrim) 509991f26f bot tests: Remove unnecessary imports. 2018-06-11 08:16:43 -04:00
neiljp (Neil Pilgrim) 031510410b xkcd tests: Use consistent imports. 2018-06-11 08:16:43 -04:00
neiljp (Neil Pilgrim) 5d211b0c84 monkeytestit tests: Use unittest.skipIf to disable tests on python < 3.5. 2018-06-11 08:16:43 -04:00