Commit Graph

504 Commits

Author SHA1 Message Date
Eklavya Sharma a2a8b54f6e Upgrade pillow.
Update test images because pillow's resize algorithm has changed.
2016-07-26 16:36:07 +05:30
rahuldeve 5ed2b01bc7 upload: Fix single attachments not being claimed on message edit.
Fixed an attachments not being claimed if just one new attachment is
added (aka the common case).
2016-07-25 17:56:27 -07:00
Ashish Kumar 8398dac025 Fix 'Invalid stream' error message in get_subscription_or_die(). 2016-07-25 14:48:48 -07:00
Ashish Kumar 56048919f5 Increase test coverage of streams API by covering JSON errors. 2016-07-25 14:48:48 -07:00
Ashish Kumar 84566c750f Add test_successful_subscriptions_add_with_announce(). 2016-07-25 14:45:29 -07:00
Ashish Kumar a143677ea2 Add test_json_get_subscribers(). 2016-07-25 14:45:28 -07:00
Ashish Kumar 9104468926 Add test_existing_subscriptions_autosubscription(). 2016-07-25 14:43:27 -07:00
Steve Howell 2846e23cfc Extracted test helper: get_and_check_messages().
This new helper combines two old helpers, one of which was misnamed
and the other of which was always called after the first, so it
made sense to just combine the helpers.

Fixes: #1386
2016-07-24 19:43:56 -07:00
Steve Howell 1da9325476 Require non-empty full_name or password in json_change_settings 2016-07-23 14:53:15 -07:00
Steve Howell 14717f414c Add default for full_name in json_change_settings. 2016-07-23 14:53:15 -07:00
Steve Howell f27ad0d800 Add test_changing_nothing_still_returns_success().
(in ChangeSettingsTest)
2016-07-23 14:53:15 -07:00
Steve Howell 728ac09df9 Remove ChangeSettingsTest.post_with_params().
The individual tests now explicitly show all the parameters
they are passing to the endpoint, which makes them easier
to troubleshoot.
2016-07-23 14:53:15 -07:00
Steve Howell f01b10f97a Improve test coverage for use_first_unread_anchor parameter.
This commit adds these two tests:

test_use_first_unread_anchor_with_some_unread_messages
test_use_first_unread_anchor_with_no_unread_messages

The new tests add coverage to the conditional logic in
get_old_messages_backend() that looks at first_unread_result
when use_first_unread_anchor is set to True.
2016-07-23 14:39:58 -07:00
Steve Howell 08f6ae7c14 Improved and renamed test_use_first_unread_anchor().
The test is now called test_use_first_unread_anchor_with_muted_topics().
Before this commit, the test exercised setting
use_first_unread_anchor to True, but it didn't inspect the
most relevant query affected by the flag.  Now it does.

This test is still kind of hard to read, and it's far from ideal,
but I'm reluctant to remove it from the test suite.
2016-07-23 14:39:58 -07:00
Steve Howell ee2007136d Test "empty list" logic in exclude_muting_conditions(). 2016-07-23 14:39:58 -07:00
Eklavya Sharma 196e021a7f Add automated tests for zerver/lib/type_debug.py. 2016-07-23 14:38:28 -07:00
Umair Khan dce48d58b6 Cache translations.
Fixes: #1158
2016-07-21 10:23:31 -07:00
acrefoot 0dfb76fc5e Change HTTP verb for create_user_backend to PUT (#1326) 2016-07-20 12:57:47 -07:00
Steve Howell 2484d870b4 Add test_build_narrow_filter(). 2016-07-20 11:04:00 -07:00
Tim Abbott fb386da552 settings: Extract settings.SAVE_FRONTEND_STACKTRACES. 2016-07-19 15:28:41 -07:00
Tim Abbott 0aaa55fb8f settings: Extract settings.SHARE_THE_LOVE. 2016-07-19 15:28:41 -07:00
Tim Abbott afaac85dc6 Move get_sqlalchemy_connection to its own file. 2016-07-19 15:28:41 -07:00
Steve Howell 83679a7775 Test search queries and highlight_string().
This increases test coverage by exercising highlight_string().
It also gives deeper test coverage to NarrowBuilder.by_search(),
which had test coverage before, but only in terms of inspecting
the SQL that was generated.  This test actually runs the SQL
under the hood.

This partly fixes #1006.
2016-07-18 16:39:19 -07:00
Tim Abbott 50c3e42f0e Fix test failure due to recent merge interaction.
599b15cb84 broke master because it had
previously only been tested before HomeTest was created.
2016-07-18 16:37:25 -07:00
Kartik Maji 599b15cb84 Allow fetching subscribers for streams the user has never subscribed to.
This allows the frontend to fetch data on the subscribers list (etc.)
for streams where the user has never been subscribed, making it
possible to implement UI showing details like subscribe counts on the
subscriptions page.

This is likely a performance regression for very large teams with
large numbers of streams; we'll want to do some testing to determine
the impact (and thus whether we should make this feature only fully
enabled for larger realms).
2016-07-18 16:24:19 -07:00
Steve Howell e341fe0102 Use topic_name() in do_edit_message_assert_error(). 2016-07-18 14:10:11 -07:00
Steve Howell 1a9a630526 Add zerver.tests.tests.HomeTest.test_home. 2016-07-18 12:22:14 -07:00
Steve Howell 6afa22f473 Add LogDictTest.test_to_log_dict(). 2016-07-17 11:25:02 -07:00
Eklavya Sharma 3ee15feeb8 Make twitter tests more readable. 2016-07-17 10:23:25 -07:00
Eklavya Sharma c389d22b5f Fix twitter mock data. 2016-07-17 10:23:25 -07:00
Rishi Gupta 09754c9861 Remove JsonableErrors from actions.do_update_message.
There were a bunch of authorization and well-formedness checks in
zerver.lib.actions.do_update_message that I moved to
zerver.views.messages.update_message_backend.

Reason: by convention, functions in actions.py complete their actions;
error checking should be done outside the file when possible.

Fixes: #1150.
2016-07-15 13:55:49 -07:00
Rishi Gupta d529a94e4d Add realm setting to time-limit editing of message content.
This is controlled through the admin tab and a new field in the Realms table.
Notes:
* The admin tab setting takes a value in minutes, whereas the backend stores it
  in seconds.
* This setting is unused when allow_message_editing is false.
* There is some generosity in how the limit is enforced. For instance, if the
  user sees the hovering edit button, we ensure they have at least 5 seconds to
  click it, and if the user gets to the message edit form, we ensure they have
  at least 10 seconds to make the edit, by relaxing the limit.
* This commit also includes a countdown timer in the message edit form.

Resolves #903.
2016-07-15 13:55:49 -07:00
Eklavya Sharma 29673411df Make backend tests (hackishly) pass on python3.4.
Replace bot_owner=bot_owner by bot_owner_id=bot_owner.id while
creating a UserProfile object.
2016-07-15 11:13:33 -07:00
Umair Khan 8dabc97d9e Add tests for frontend i18n regexes. 2016-07-15 14:48:09 +05:00
Steve Howell 9d7716f368 Add message.topic_name() helper function.
This little helper will facilitate adding a new Topic
table in the future.
2016-07-14 09:54:56 -07:00
Steve Howell a5b9e3b893 Add test_patch_bot_avatar().
Fixes: #1002
2016-07-13 22:53:46 -07:00
Steve Howell 538962f3ca Add test_add_bot_with_username_in_use(). 2016-07-13 22:53:40 -07:00
Steve Howell 468faf5724 Add test_add_bot_with_bad_username(). 2016-07-13 22:53:40 -07:00
Steve Howell de4cc80aa0 Add test_add_bot_with_too_many_files(). 2016-07-13 22:53:40 -07:00
Steve Howell e9ddf28b2c Add test_add_bot_with_user_avatar(). 2016-07-13 22:53:40 -07:00
Tomasz Kolek f689fbfa4d Replace old Trello integration with a webhook integration.
Fixes: #709.

[With tweaks on the documentation by tabbott]
2016-07-13 21:00:27 -07:00
Steve Howell 191ac80475 Remove callback logic from test_helpers.DummyHandler. 2016-07-13 19:08:28 -07:00
Eklavya Sharma d7ea2b8a67 zerver/tests/test_upload.py: Use byte strings.
Some string literals are incorrectly marked as `str` strings.
Change them to byte strings.
2016-07-13 16:00:46 -07:00
Eklavya Sharma a7d2dab28f Fix non-deterministic output from Taiga integration.
Taiga's webhook integration would give output events in a random
order which caused test failures on python 3 (seems like python
3 is more prone to non-deterministic failures).  Fix that by
sorting the outputs obtained from events before concatenating them.
2016-07-13 16:00:46 -07:00
Eklavya Sharma 5382aeb385 Render PagerDuty message using ujson.dumps.
Use ujson.dumps to render raw messages sent by the PagerDuty
integration instead of using pprint.pformat.  pprint.pformat
gives different results on python 2 and 3.
2016-07-13 16:00:46 -07:00
Eklavya Sharma 4f633bcd0b zerver/lib/notifications.py: Fix string encoding/decoding.
Correctly encode and decode strings in convert_html_to_markdown.
It wasn't possible to use universal_newlines=True since
Popen.communicate doesn't encode/decode strings correctly on
python 2.
2016-07-13 16:00:46 -07:00
Eklavya Sharma e6502710b6 Change exception.message to str(exception).
The 'message' attribute in Exception has been deprecated.
It has been removed in python 3.
2016-07-13 16:00:46 -07:00
Eklavya Sharma 993558c680 Get mogrified SQL queries as text.
zerver.lib.test_helpers.queries_captured returns a byte string,
while we want the queries to be text.  So decode the captured
queries.
2016-07-13 16:00:46 -07:00
Umair Khan 395e053ce3 Revert "Revert "Extract reply from email.""
This reverts commit f1ba3ded42.
2016-07-13 11:24:18 -07:00
Umair Khan 636466ff8b Fix unreliable tests for missed messages.
Generate random token using getrandints.

Resolves the proximal issue discussed in #1212.
2016-07-13 10:51:21 -07:00