Commit Graph

4156 Commits

Author SHA1 Message Date
Tim Abbott 7bcf24d39c test_management_commands: Reset settings.RUNNING_INSIDE_TORNADO.
This fixes a leak of this setting change that resulted from the
unusual way that our Tornado system sets this variable early in the
management command.

Fixes #3685.
2017-03-23 23:56:10 -07:00
Tim Abbott 3617ebfd41 api: Rename get_old_messages to get_messages in the backend.
Fixes #1315.
2017-03-23 23:52:44 -07:00
wizsid11 95789eb879 Add Slack webhook.
Adds a new webhook integration for Slack to receive messages
from one's Slack team's public channels.
Contains negative tests for broken, missing or invalid data.

Allows two different option for integration:
1. Receive notification on a single stream with different topics
for each of Slack's public channels.
2. Receive notification on different streams for each of Slack's
public channels.

Steps to choose between the two options is described in the documentation.

Fixes #3569.
2017-03-23 23:32:38 -07:00
Tomasz Kolek be0a2cb20b Add basecamp3 webhook integration.
Fixes: #3949.
2017-03-23 23:28:53 -07:00
Tomasz Kolek 09f5180da9 github_webhook: Return 200 OK if event is not supported.
Change raising exception when event is not supported to just logging it.
2017-03-23 23:26:55 -07:00
Tomasz Kolek fcd091132d jira: Return 200 OK if event is not supported. 2017-03-23 23:26:55 -07:00
Tim Abbott a6ae546f59 test_events: Bring zerver/lib/events.py to 100% coverage. 2017-03-23 22:43:10 -07:00
Tim Abbott 0c16cc1c1e test_events: Add a test for do_refer_friend. 2017-03-23 22:43:10 -07:00
Tim Abbott 055a18e71f test_events: Add a test for do_update_embedded_data. 2017-03-23 22:43:10 -07:00
Tim Abbott eb19a25aba events: Fix races in stream creation event and add tests.
This fixes 2 issues:
* Being added to an invite_only stream did not correctly update the
  "streams" key of the initial state.

* Once that's resolved, subscribe_to_stream when called on a
  nonexistant stream would both send a "create" event (from
  create_stream_if_needed) and an "occupy" event (from
  bulk_add_subscriptions).

  The second event should just be suppressed in that case, and this
  implements that suppression.
2017-03-23 22:43:09 -07:00
Tim Abbott 8eb020d190 test_events: Add a test for do_update_muted_topic. 2017-03-23 22:27:39 -07:00
Tim Abbott dbe3ea59aa test_events: Add a failing presence test.
Apparently our presence real-time sync is slightly broken; this test
at least reveals that fact.
2017-03-23 22:27:39 -07:00
Tim Abbott d1760a1bb9 validators: Add check_float validator. 2017-03-23 21:23:41 -07:00
Tim Abbott 12a6913bbf test_events: Add a test for do_update_message_flags. 2017-03-23 21:11:33 -07:00
Tim Abbott 2b905d242d events: Fix timezone realm-time sync and add test. 2017-03-23 19:11:34 -07:00
Tim Abbott 86e3d1effc events: Fix default language realm-time sync and add test.
We previously didn't apply the default language event change
correctly.

Not super important as a bug, since we require the user to reload the
browser for their changes to take effect, but this will save time if
we ever change that.
2017-03-23 19:08:17 -07:00
Tim Abbott 99515c2d34 test_events: Add tests for default streams being None. 2017-03-23 19:04:13 -07:00
Tim Abbott adcf8263d6 tests: Fix passing non-unicode strings to do_set_realm_property.
This fixes test failures on Python 3 caused by
a98bce98c6.
2017-03-23 18:37:12 -07:00
Tim Abbott a98bce98c6 realm: Add registry of realm property types.
This makes it possible for us to do some convenient validation for
developers, checking whether the correct types are passed for each
each realm property.
2017-03-23 17:55:50 -07:00
Sarah Stringer 09f66b5c6d actions: Add do_set_realm_property function and migrate to it.
zerver/lib/actions: removed do_set_realm_* functions and added
do_set_realm_property, which takes in a realm object and the name and
value of an attribute to update on that realm.

zerver/tests/test_events.py: refactored realm tests with
do_set_realm_property.

Kept the do_set_realm_authentication_methods and
do_set_realm_message_editing functions because their function
signatures are different.

Addresses part of issue #3854.
2017-03-23 17:52:45 -07:00
Umair Khan 2d4a1f93ff testing: Bring zproject.backends coverage to 100%. 2017-03-23 17:12:58 -07:00
Tim Abbott 36988f9375 mypy: Fix Optional typing issues in tex.py. 2017-03-23 15:49:08 -07:00
Akash Kothawale 4c2bfae83e get_stream: Throw DoesNotExist if stream is not found.
This makes get_stream match get_realm, get_user_profile_by_email,
etc., in interface, and is more convenient for mypy annotations
because `get_stream` now doesn't return an Optional[Stream].
2017-03-23 15:42:00 -07:00
Tim Abbott 06492738b5 dev: Expose coverage and built documentation to web.
This makes it much more convenient for developers to access coverage
and built developer documentation.
2017-03-23 13:10:06 -07:00
Tim Abbott 97e844e97c test_notifications: Don't pass a user_profile to client_patch.
This fixes a JSON overflow error when producing URL coverage reports.
2017-03-23 13:08:49 -07:00
Tim Abbott f3af0fe635 reactions: Fix reacting to messages on streams you're not subscribed to.
We use the same strategy Zulip already uses for starred messages,
namely, creating a new UserMessage row with the "historical" flag set
(which basically means Zulip can ignore this row for most purposes
that use UserMessage rows).  The historical flag is ignored, however,
in determining which users' browsers to notify about new reactions,
and thus the user will get to see the reaction appear when they click
a message (and any reactions other users later add, as well!).

There's still something of a race here, in that if some users react to
a message while the user is looking at the unsubscribed stream but
before the user reacts to that message, those reactions will not be
displayed to that user (so counts will be a bit lower, or something).
This race feels small enough to ignore for now.

Fixes #3345.
2017-03-22 20:22:13 -07:00
Tim Abbott 60326ca94c test_events: Add reaction tests. 2017-03-22 20:22:02 -07:00
Tim Abbott 0963f2d518 reactions: Extract notify_reaction_update. 2017-03-22 20:22:02 -07:00
Tim Abbott 67a4ce99ee tutorial: Disable tutorial for default development users.
You can always make a new user if you need to test the tutorial, and
this will save a bunch of developer time ignoring the tutorial popup.
2017-03-22 15:30:36 -07:00
hollywoodno d6716838ad bugdown: Remove trailing whitespace on fence code blocks.
This fixes fenced code blocks that are copy-pasted from certain
clients having trailing whitespace anoyingly often.

Fixes #3998.
2017-03-22 14:17:34 -07:00
Tim Abbott 0fec03f8bb test_docs: Fix normal users test text. 2017-03-22 13:14:19 -07:00
sinwar 397e9c109e auth: Separate development login from main login page.
This allows us to enable EmailAuthBackend by default in development
without cluttering the development login experience.

Fixes #3652.
2017-03-22 12:54:30 -07:00
Rishi Gupta 4c88b3f5da logging_util: Fix timezone-naive datetime being compared to aware datetime.
Fixes regression in 3d07ac0.
2017-03-22 12:51:58 -07:00
Umair Khan 3c0f341eb7 test_subs.py: Change assert_max_length to assert_length. 2017-03-22 12:07:21 -07:00
Umair Khan 804c62045f testing: Flush API_KEYS before every test.
This makes our test performance for each test more consistent.
2017-03-22 12:07:06 -07:00
Umair Khan ff8ab054da testing: Fix query count for test_bulk_subscribe_MIT.
test_subs.SubscriptionAPITest.test_bulk_subscribe_MIT fails when it is
run individually.
2017-03-22 12:07:06 -07:00
Umair Khan 8431ceace2 testing: Serialize BotTest with upload tests. 2017-03-22 11:59:30 -07:00
Yago González 34a9e1ae11 markdown: Add TeX typesetting support.
Co-authored-by: Reid Barton <rwbarton@gmail.com>

Fixes #2056.
2017-03-21 16:40:00 -07:00
Rishi Gupta caef5332d5 mailchimp: Fix error in add_users_to_mailing_list.py.
Old behavior is a holdover from development testing.
2017-03-21 16:13:00 -07:00
Tim Abbott 993276b882 test_upload: Add tests for realm icon URL scheme. 2017-03-21 16:12:04 -07:00
Tim Abbott 8775a22663 avatar: Fix buggy avatar URL scheme with S3 backend.
Also adds tests for the avatar URL scheme.
2017-03-21 16:12:04 -07:00
Ayush Jain bddcfb1c96 Add realm-level settings to control inline image and url preview.
This gives users more control in case they don't want previews,
especially for the "previews of linked websites" feature.

Fixes: #2640.
2017-03-21 15:46:17 -07:00
Umair Khan a2aeddba6b testing: Add infrastructure for running backend tests in parallel.
This doesn't yet provide an option to actually run the backend tests
parallelized yet.
2017-03-21 10:59:12 -07:00
Tim Abbott 6d452e87a5 context_processors: Handle requests without user set.
If `render()` is called from middleware that runs before the
authentication middleware, then this code path will be called with a
request object where request.user is not yet set.  Handle this by
providing a reasonable error message.
2017-03-21 10:06:39 -07:00
Tim Abbott a474f4359d tests: Set maxDiff to None unconditionally. 2017-03-21 07:34:16 -07:00
Tim Abbott c2c02ea4da middleware: Fix typo in render_to_response migration.
This fixes a 500 on the invalid realm page.
2017-03-21 07:30:28 -07:00
adnrs96 8ae35211b5 migration: Sync sizes for existing Attachment objects with actual files.
Tweaked by tabbott to add a nop reverse migration.

Fixes #3883.
2017-03-21 00:53:22 -07:00
Tim Abbott aa7e4fec35 messages: Require join with zerver_message if use_first_unread_anchor.
This fixes a 500 bug where the RN mobile app would simply fail to load
old messages if use_first_unread_anchor was not set.
2017-03-21 00:02:46 -07:00
Steven Ganz 5041d86db0 tests: Add several missing tests to test_events.
This fixes part of #3633.

Extracted by tabbott from #4162 as ready to merge now.
2017-03-19 23:12:12 -07:00
Tim Abbott ceeb95ebb1 tests: Fix missing test coverage for /json/realm.
In aa880b0419, we used the raw
do_set_realm_description method rather than calling the API, which
meant that the API success path wasn't actually tested.
2017-03-19 22:49:16 -07:00