Steve Howell
38f2a2f475
Add client_post() test helper.
...
This makes us more consistent, since we have other wrappers
like client_patch, client_put, and client_delete.
Wrapping also will facilitate instrumentation of our posting code.
2016-07-27 20:49:32 -07:00
Steve Howell
51bae8abc4
Remove stub() test helper.
2016-07-27 14:12:10 -07:00
rahuldeve
ec6c9ba436
Add test for removing an uploaded file via message editing.
...
Fixes #1373 .
2016-07-27 14:10:15 -07:00
rahuldeve
4267dcbb68
Change the way referred attachments are removed on message update.
...
This fixes incorrect behavior when two or more attachments are removed
in the same message.
2016-07-27 14:08:59 -07:00
Tim Abbott
df525ad1c5
Remove old MitUser model and related code.
...
The MitUser model caused a constant series of little problems for
users with mit.edu email addresses trying to sign up for different
Zulip servers.
The new implementation just uses conditionals on the realm object when
selecting the confirmation template to use.
2016-07-26 20:30:12 -07:00
Tim Abbott
ed6c134cf4
Clean up and document clean_email code path.
2016-07-26 20:30:12 -07:00
Tim Abbott
375551aaa6
Clean up most hardcoding of mit.edu domain checks.
...
This moves all this code to be gated on a few virtual realm settings.
2016-07-26 20:30:12 -07:00
Tim Abbott
70543e059a
bugdown: Remove hardcoding of mit.edu for zephyr_mirror realm config.
2016-07-26 20:30:12 -07:00
Tim Abbott
c17676b00c
Cleanup MIT hardcoding for disabling presence.
2016-07-26 20:30:12 -07:00
Tim Abbott
884f50cdd7
validate_user_access: Assert user_profile is not None.
...
This function is only called in cases where user_profile isn't None,
and the code reads better if we just check that first rather than
checking it on every line that accesses user_profile.
2016-07-26 20:30:12 -07:00
Tim Abbott
d1adbd798b
get_subscribers_to_streams: Pass through requesting_user.
2016-07-26 20:30:12 -07:00
Tim Abbott
691ad7fcfc
maybe_get_subscriber_emails: Pass user_profile through.
2016-07-26 20:30:12 -07:00
Tim Abbott
f790a04102
Remove unused get_subscriber_ids.
2016-07-26 20:30:12 -07:00
Tim Abbott
1771b8275c
Remove unused get_other_subscriber_ids.
2016-07-26 20:30:12 -07:00
Steve Howell
eb11e02309
Add MirroredMessageUsersTest.
2016-07-26 20:01:36 -07:00
Steve Howell
3fa745ebe3
Remove untested code in is_public_stream().
...
We were calling valid_stream_name(), but more appropriate
validation checks for stream names happen elsewhere in the codepath.
2016-07-26 18:10:00 -07:00
Steve Howell
81cd9d33e4
Add test_non_string_narrow_operand_in_dict().
2016-07-26 18:10:00 -07:00
Tim Abbott
b2d1c18268
views: Move push token views to new push_notification.py.
2016-07-26 14:44:24 -07:00
Tim Abbott
6dc5681171
views: Move presence views to presence.py.
2016-07-26 14:29:32 -07:00
Tim Abbott
62affa53c9
views: Move update_realm to new realm.py views file.
2016-07-26 14:29:24 -07:00
Umair Khan
7c138c6e33
Import is_inactive from proper file.
2016-07-26 12:26:55 -07:00
Eklavya Sharma
e0dbaf1031
Use universal_newlines=True in subprocess.check_output.
...
In python 3, subprocess uses bytes for input and output if
universal_newlines=False (the default). It uses str for input and
output if universal_newlines=True.
Since we mostly deal with strings, add universal_newlines=True to
subprocess.check_output.
2016-07-26 12:06:41 -07:00
Eklavya Sharma
5ce80eb4ba
Update types of images accepted as avatars.
...
* Reject SVG in frontend because backend doesn't accept it.
* Add JPEG format in backend tests for avatar upload.
2016-07-26 16:36:47 +05:30
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
rahuldeve
e06d5fbec9
Pass Message object instead of message dict to do_claim_attachments.
2016-07-25 17:54:36 -07:00
rahuldeve
c61d149837
Pass Message object instead of message dict to claim_attachment.
2016-07-25 17:51:17 -07:00
Steve Howell
57c436b32d
Add TODOs for #1379 (bugdown mutual dependency)
2016-07-25 14:59:32 -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
Eklavya Sharma
5b06edc402
zerver/lib/type_debug.py: Handle container types better.
2016-07-23 14:35:39 -07:00
Eklavya Sharma
a632c71cce
Add zerver/lib/type_debug.py.
...
This file has a decorator print_types, which makes the decorated
function print the types of its arguments whenever it is called.
2016-07-23 14:35:39 -07:00
Taranjeet Singh
9bea1f46c7
zerver/views/webhooks/bitbucket2.py: Fix line with length greater than 120.
2016-07-23 14:33:11 -07:00
Tim Abbott
eba2d470dc
Fix removing attachments when editing a message.
...
Fixes #1373 .
2016-07-22 14:48:47 -07:00
Tim Abbott
4de203a23f
Fix MIT users joining a Zulip realm.
2016-07-22 14:27:36 -07:00
Eklavya Sharma
09e4e5aea7
Add links after `type: ignore`s.
2016-07-22 13:59:31 -07:00
Eklavya Sharma
674f6999e1
Improve annotations of decorators.
2016-07-22 11:14:33 -07:00
Eklavya Sharma
4b7d94564a
zerver/views/streams.py: Annotate variables to help mypy.
2016-07-22 11:14:33 -07:00
Eklavya Sharma
07e36d87a2
Remove return where no return value is expected.
...
zerver.lib.notifications.send_future_email has return type None.
So replace `return send_future_email(...` by `send_future_email(...`.
2016-07-22 11:14:33 -07:00
Krit Karan
a61ef3bc0e
Reformat the content variable in ``do_refer_friend()``.
...
Fixes #1162 .
2016-07-22 10:36:35 -07:00
Eklavya Sharma
c59740385d
zerver/lib/str_utils.py: Replace ValueError by TypeError.
...
When a parameter of a wrong type is passed to a `force_*` method
in str_utils.py, raise a TypeError.
2016-07-21 23:14:00 +05:30
Umair Khan
dce48d58b6
Cache translations.
...
Fixes : #1158
2016-07-21 10:23:31 -07:00
hackerkid
b6620cfa57
Replace UserProfile with HttpRequest in logged_in_and_active.
2016-07-20 20:08:00 -07:00
Tim Abbott
c791037166
narrow: Document BuildNarrowFilterTest.
2016-07-20 14:18:40 -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
19b860ceec
Rename local_settings.py symlink to prod_settings.py.
2016-07-19 20:59:59 -07:00
Tim Abbott
e876f12b83
settings: Extract settings.WELCOME_EMAIL_SENDER.
2016-07-19 15:28:41 -07:00
Tim Abbott
7725c62892
Use VERBOSE_SUPPORT_OFFERS in day1 emails.
2016-07-19 15:28:41 -07:00
Tim Abbott
3ea4cbb5c3
settings: Extract settings.VERBOSE_SUPPORT_OFFERS.
2016-07-19 15:28:41 -07:00
Tim Abbott
ff1faffecd
settings: Extract EMAIL_GATEWAY_EXTRA_PATTERN_HACK.
2016-07-19 15:28:41 -07:00
Tim Abbott
82f78621dd
settings: Extract CUSTOM_LOGO_URL.
2016-07-19 15:28:41 -07:00
Tim Abbott
de679a23c9
settings: Extract settings.REGISTER_LINK_DISABLED.
2016-07-19 15:28:41 -07:00
Tim Abbott
c25b077224
settings: Extract settings.SHOW_OSS_ANNOUNCEMENT.
2016-07-19 15:28:41 -07:00
Tim Abbott
fb386da552
settings: Extract settings.SAVE_FRONTEND_STACKTRACES.
2016-07-19 15:28:41 -07:00
Tim Abbott
522ccf8eb2
settings: Extract settings.STAGING_ERROR_NOTIFICATIONS.
2016-07-19 15:28:41 -07:00
Tim Abbott
1f4c9eefe4
settings: Extract settings.ZILENCER_ENABLED.
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
Taranjeet Singh
5462341cb4
zerver/views/webhooks/github.py: Fix lines with length greater than 120.
2016-07-18 15:10:41 -07:00
Taranjeet Singh
3031214718
zerver/views/messages.py: Fix line with length greater than 120.
2016-07-18 15:05:52 -07:00
Tim Abbott
3c591aa724
compilemessages: Don't try to include zh-CN and zh_CN in language options.
2016-07-18 15:02:43 -07:00
Tim Abbott
55a98a41d8
compilemessages: Improve error handling for unknown locale.
2016-07-18 15:02:43 -07:00
Taranjeet Singh
84660a5087
zerver/views/__init__.py: Fix lines with length greater than 120.
2016-07-18 14:51:06 -07:00
Taranjeet Singh
37ea785b8f
zerver/forms.py: Fix line with length greater than 120.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
9f3f82d06d
zerver/lib/socket.py: Fix line with length greater than 120.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
5499136bfd
zerver/views/webhooks/teamcity.py: Fix line with length greater than 120.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
7199ee8f08
zerver/views/webhooks/taiga.py: Fix line with length greater than 120.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
3e17011f9c
zerver/views/webhooks/pivotal.py: Fix line with length greater than 120.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
c437659cd9
zerver/views/webhooks/pingdom.py: Fix line with length greater than 120.
...
zerver/views/webhooks/pingdom.py: Fix indetation for function args.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
7ddb254d2e
zerver/views/webhooks/circleci.py: Fix line with length greater than 120.
...
zerver/views/webhooks/circleci.py: Fix indentation for function args.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
1323685140
zerver/views/webhooks/beanstalk.py: Fix line with length greater than 120.
...
zerver/views/webhooks/beanstalk.py: Capture string in a temp variable.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
569d14a826
zerver/views/webhooks/airbrake.py: Fix line with length greater than 120.
...
zerver/views/webhooks/airbrake.py: Fix Indentation.
zerver/views/webhooks/airbrake.py: Fix Indentation for args in function.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
10afbc06f9
zerver/views/report.py: Fix line with length greater than 120.
...
zerver/views/report.py: Capture string in temporary variables.
2016-07-18 14:42:39 -07:00
Taranjeet Singh
24ba060421
Fix line with length greater than 120 in deliver_email.py.
2016-07-18 14:34:34 -07:00
Tim Abbott
014a13df7c
cache: Fix echoing of mkdir command to console.
2016-07-18 14:25:13 -07:00
Taranjeet Singh
ba3f9de9a9
zerver/lib/cache.py: Move remote_cache_prefix to var directory.
...
This commit ensures the var directory exists before its needed in both
development and production environments.
2016-07-18 14:13:02 -07:00
Steve Howell
8ac1398b0f
Use topic_name() in to_log_dict().
2016-07-18 14:10:11 -07:00
Steve Howell
e341fe0102
Use topic_name() in do_edit_message_assert_error().
2016-07-18 14:10:11 -07:00
Steve Howell
2bfa763c0b
Use topic_name() in update_message_backend().
2016-07-18 14:10:11 -07:00
Umair Khan
b546391f0b
Move locale to static/locale
2016-07-18 13:59:07 -07:00
Umair Khan
cdf2664030
`makemessages` command should not remove plurals.
2016-07-18 13:59:07 -07:00
Steve Howell
1a9a630526
Add zerver.tests.tests.HomeTest.test_home.
2016-07-18 12:22:14 -07:00
Steve Howell
5fcbd0a178
Remove muting logic in approximate_unread_count().
...
The muting logic in approximate_unread_count() was confusing
stream/subject and only using the first of many stream/subject
pairs, so it was rarely excluding rows from the count, and when
it did exclude rows, they were the wrong rows.
This fixes part of #1300 , but we may want to keep the issue open.
2016-07-18 11:21:51 -07:00
Eklavya Sharma
e10caf0b65
Gracefully give up when using email-mirror on python 3.
...
Running `./manage.py email-mirror` used to fail on python 3
because twisted.mail.imap4 is not python 3 compatible.
Display a message informing the user that email-mirror is not
available on python 3 instead of failing with a traceback.
Also add tools/test-management to py3-backend.
2016-07-18 09:57:28 -07:00
Steve Howell
6afa22f473
Add LogDictTest.test_to_log_dict().
2016-07-17 11:25:02 -07:00
Eklavya Sharma
da36947400
Change unbuffering strategy in runtornado.py.
...
runtornado unbuffers its output using
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0).
This is not python 3 compatible since we can't specify
buffering on a text stream in python 3. So use the '-u'
option of python when calling runtornado.py to make output
unbuffered.
2016-07-17 10:31:15 -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
Eklavya Sharma
fb1d00fc6c
Upgrade python-twitter to latest version.
...
Fixes #1145 .
2016-07-17 10:23:25 -07:00
Eklavya Sharma
4130170da8
bugdown: Fix string handling.
...
Use unicode strings where needed and correctly encode/decode strings.
2016-07-17 10:23:25 -07:00
Eklavya Sharma
abe7faa2f9
bugdown: Annotate some variables.
2016-07-17 10:23:25 -07:00
Steve Howell
60bd20da61
Remove zerver/lib/query.py (dead code).
2016-07-16 14:51:15 -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
Eklavya Sharma
8c0d7311ac
zerver/decorator.py: Use BytesIO to read request.
...
Use BytesIO instead of StringIO to get a file-like object on the
request's body.
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
Umair Khan
a07a810a2e
Fix regex for capturing frontned strings.
...
Fixes : #1155
2016-07-15 14:48:05 +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
21fb7693d2
Add test_helpers.client_patch_multipart().
2016-07-13 22:53:40 -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
701bb7a59f
Remove test_helpers.DummySession
2016-07-13 19:08:28 -07:00
Steve Howell
616e49e2e8
Remove test_helpers.DummyTornadoRequest
2016-07-13 19:08:28 -07:00
Steve Howell
0060ea7903
Remove test_helpers.DummyStream
2016-07-13 19:08:28 -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
Tim Abbott
c0a6672471
Update path to language_options.json in production.
...
The previous code didn't correctly transport language_options.json to
the production environment.
2016-07-13 12:30:45 -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
f15dfc69fb
Make code Python 3 compatible.
...
Make convert_html_to_markdown function Python 3 compatible.
2016-07-13 11:24:18 -07:00
Tim Abbott
34a251adb1
upload: Fix exception uploaded files with unknown content type.
...
It turns out our detected content_type can actually be None, which
meant calling force_text on it broke uploading some files.
2016-07-13 10:57:55 -07:00
Umair Khan
0aae0eab49
Switch to PyAPNS for sending push notifications.
...
Switch to [PyAPNS](https://github.com/djacobs/PyAPNs ).
Fixes #538 .
2016-07-13 10:55:07 -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
Steve Howell
c069c8f1e7
Add test_update_api_key_for_invalid_user().
2016-07-13 07:51:00 -07:00
Steve Howell
aea79517f5
Test bot_owner logic in /json/users
...
This fixes a small gap in our coverage for get_members_backend.
2016-07-12 23:01:56 -07:00
Steve Howell
108ce82571
Add test_api_with_insufficient_permissions().
2016-07-12 22:16:00 -07:00
Steve Howell
cee47e7f82
Add test_api_with_nonexistent_user().
2016-07-12 22:16:00 -07:00
Steve Howell
f43be3bd8f
Add test_updating_non_existent_user().
2016-07-12 22:16:00 -07:00
Tim Abbott
647cead0d1
slow queries: Include full log line in slow query log.
...
The extra data is useful, and I think this won't make the lines annoying long.
2016-07-12 19:12:49 -07:00
Tim Abbott
305189956b
update_message_flags: Log number of messages updated.
2016-07-12 19:12:49 -07:00
Eklavya Sharma
e28b038f1d
Use assert_in_response by fixing line-wrapping in templates.
2016-07-12 17:52:47 -07:00
Steve Howell
3923f94a2b
Remove unused code path in avatar() endpoint.
2016-07-12 17:37:02 -07:00
Steve Howell
3995a5d8eb
Add test coverage for /avatar/<email>
2016-07-12 17:37:02 -07:00
Tomasz Kolek
d0066c37ff
Add bitbucket2 integration.
...
Bitbucket changed the format of their API. The old format is still
useful for BitBucket enterprise, but for the main cloud verison of
Bitbucket, we need a new BitBucket integration supporting the new API.
2016-07-12 17:34:34 -07:00
Eklavya Sharma
c98c3d5f8d
Re-enable some backend tests on python 3.
2016-07-12 14:06:29 -07:00
Eklavya Sharma
d740a87d04
zerver/tests: Use unicode strings.
...
* Use unicode strings for strings containing non-ASCII characters.
* Decode response content when text output is expected.
2016-07-12 14:06:29 -07:00
Eklavya Sharma
161c27d0e9
Add methods to AuthedTestCase to test response content.
...
Add methods assert_equals_response and assert_in_response to
AuthedTestCase. These methods make it convenient to check if
a string equals the contents of an HttpResponse's body or if a
string is a substring of the contents of an HttpResponse's body.
2016-07-12 14:06:29 -07:00
Eklavya Sharma
2080ff6c2a
Decode response.content everywhere except in tests.
...
response.content is binary data, but code usually assumes it to
be text. Fix this by decoding response.content where required.
Don't do this in tests yet.
2016-07-12 14:06:29 -07:00
Steve Howell
45d1eefc52
Add test_create_user_backend().
...
This tests provides full line coverage on the
create_user_backend view.
2016-07-12 12:29:24 -07:00
Eklavya Sharma
73a3c9fa47
On python 3, skip expected failures in backend tests.
2016-07-12 09:27:55 -07:00
Eklavya Sharma
4868cd9969
zerver/lib/test_helpers.py: Add skip_py3 decorator.
2016-07-12 09:27:55 -07:00
Eklavya Sharma
0a9c600c8b
Show skipped tests in test runner.
2016-07-12 09:27:55 -07:00
Eklavya Sharma
958335bdb3
Change all default values in models to unicode.
2016-07-11 21:30:32 -07:00
Tomasz Kolek
d7c7279523
Add is_status_message method to Message model.
2016-07-11 12:09:06 -07:00
Tim Abbott
e21bc11cfd
Extract attachment_url_to_path_id.
2016-07-10 18:07:37 -07:00
Tim Abbott
48ae178d0b
Refactor attachment_url_re to be a common value in upload.py.
2016-07-10 18:04:58 -07:00
rahuldeve
c5756e4fa4
Update attachment tracking on message update.
2016-07-10 18:01:59 -07:00
Tim Abbott
3647973069
update_message_backend: Reorganize validation checks.
...
The new organization more clearly does the permission check first.
2016-07-10 18:01:59 -07:00
Tim Abbott
05632b68e1
edit: Add validation for setting empty content.
2016-07-10 18:01:59 -07:00
Tim Abbott
0d418d5695
Add some message editing tests for invalid input.
2016-07-10 18:01:59 -07:00
Tim Abbott
211a166abc
message edit: Move new topic non-empty check to view.
2016-07-10 18:01:59 -07:00
Eklavya Sharma
0900ca5353
Replace assertItemsEqual by assertEqual.
...
This is needed because assertItemsEqual doesn't exist in python 3.
2016-07-10 17:33:11 -07:00
Rishi Gupta
43c2f35776
Add realm setting to disable message editing.
...
This is controlled through the admin tab and a new field in the Realms
table. This mirrors the behavior of the old hardcoded setting
feature_flags.disable_message_editing. Partially resolves #903 .
2016-07-10 11:57:24 -07:00
Rishi Gupta
07e7230ae1
models.py: Add post_save to Message.
...
Flushes message from cache after a message.save(). Needed for tests
where we directly manipulate Message objects in the database.
2016-07-10 11:42:18 -07:00
Eklavya Sharma
f1ba3ded42
Revert "Extract reply from email."
...
This reverts commit f1f48f305e
.
The use of sklearn unfortunately caused a substantial slowdown to the
Zulip provisioning process, which didn't seem worth it for a
relatively minor feature.
2016-07-10 11:30:30 -07:00
Eklavya Sharma
9161ddaee0
zerver/middleware.py: Handle binary data in errors.
...
In write_log_line, error_content can be binary_type and
error_content_iter can be a Sequence of binary_type. Handle
this this in a python 3 compatible way. Also change annotations
to reflect this fact.
2016-07-10 11:30:13 -07:00
Steve Howell
c671881713
decorators: Extract is_local_addr().
2016-07-09 17:58:48 -07:00
Steve Howell
8e528569a7
Clean up rate_limit() for deployments that opt out.
...
If settings.RATE_LIMITING is False, short circuit rate
limiting earlier in rate_limit(). This change particularly
avoids inspect request.user and possibly spamming the error
log for sites that don't care about rate limiting.
2016-07-09 17:58:20 -07:00
Eklavya Sharma
801bcdd956
zerver/tests/tests.py: Fix non-deterministic failure.
...
Replace occurences of list(d.keys()) by sorted(d.keys()).
2016-07-09 17:54:54 -07:00
Eklavya Sharma
1f3ce7cf38
zerver/worker/queue_processors.py: Open file in binary.
...
Open a file in binary mode instead of text mode.
2016-07-09 17:54:54 -07:00
Eklavya Sharma
2f2e543a0e
zerver/tests/tests.py: Replace assertItemsEqual.
...
Replace assertItemsEqual(a, b) by assertEqual(sorted(a), sorted(b))
because assertItemsEqual has been removed in python 3.
2016-07-09 17:54:54 -07:00
Steve Howell
89105e41d7
Added TestInternalNotifyView.
2016-07-09 07:47:12 -07:00
Steve Howell
ce14a3551d
Added test_get_client_name().
2016-07-09 07:37:13 -07:00
Steve Howell
69f18c26fc
Improve test_api_key_only_webhook_view().
...
This test now covers all lines of api_key_only_webhook_view(),
including the error logic and rate limiting logic.
2016-07-09 07:37:13 -07:00
Steve Howell
3d095beb63
Extracted client_is_exempt_from_rate_limiting().
2016-07-09 07:37:13 -07:00
Steve Howell
49543b9ec4
Added RateLimitTestCase tests.
2016-07-09 07:37:13 -07:00
Steve Howell
c680c6a981
Removed unused to_non_negative_float() function.
2016-07-09 07:37:13 -07:00
Umair Khan
b7ec66fc96
Remove templates, styles and js through storage.
2016-07-09 07:33:35 -07:00
Umair Khan
043ae8ad65
Upgrade to Django-Pipeline==1.6.8.
2016-07-09 07:09:55 -07:00
Umair Khan
2d243c0703
get_all_templates should not return __init__.py.
2016-07-09 07:09:55 -07:00
Tim Abbott
1e2d38e790
Move stringify_message_dict into to_dict_uncached.
2016-07-08 17:58:56 -07:00
Tim Abbott
72e948d19a
Remove now-unused message_cache_key message cache.
...
Originally this cache was used to transmit data from Django to Tornado
(and also for general message caching purposes), but now nothing
actually reads from this cache, so we can eliminate it.
2016-07-08 17:58:56 -07:00
Tim Abbott
8d5ec14b31
cache_helpers: Fill to_dict cache instead of old message cache.
...
Apparently, the message cache we were filling was completely useless
and unused, and furthermore, the cache we were filling as part of
restarting the server was also totally useless, since it didn't have
the messages users would be requesting.
2016-07-08 17:58:56 -07:00
Taranjeet
a8a4caf2c0
zerver: Fix lines with length greater than 120.
2016-07-08 11:41:43 -07:00
Umair Khan
f1f48f305e
Extract reply from email.
2016-07-08 10:58:25 -07:00
Umair Khan
75bd3541ea
Add tests for new email policy.
...
- Update test_extra_context_in_missed_stream_messages
- Add test_extra_context_in_personal_missed_stream_messages
- Add test_extra_context_in_huddle_missed_stream_messages
2016-07-08 10:58:25 -07:00
Umair Khan
8538ba8ea8
Remove do_send_missedmessage_events function.
2016-07-08 10:58:25 -07:00
Umair Khan
06355105f5
Missed message emails should come from user email.
...
Fixes #448
FIxes #612
2016-07-08 10:58:25 -07:00
Eklavya Sharma
3e9349df4f
zerver/decorator.py: Use force_bytes instead of encode.
...
The value type of request.META is str, not text type.
So use force_bytes on the data instead of encode('utf-8').
2016-07-08 01:24:30 +05:30
Eklavya Sharma
4cf7641ab1
zerver/tests/test_i18n.py: Ignore due to incomplete stubs.
...
In python 3, http.cookies has incomplete stubs.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
6c3f1bb967
beanstalk.py: Encode and decode strings correctly.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
26b8e7357a
zerver/views/messages.py: Operate on bytes in highlight_string.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
83640ed0cd
runtornado.py: Ignore due to incorrect stubs.
2016-07-07 10:09:35 -07:00
Eklavya Sharma
6fd8906358
rename_stream.py: Fix broken code.
...
* get_realm returns None if no matching realm is present, but
create_stream.py assumed it raises Realm.DoesNotExist.
* encoded/decode strings properly.
2016-07-07 10:08:29 -07:00
Eklavya Sharma
c679c180f5
enqueue_file.py: Add type hint for mypy.
2016-07-07 10:07:51 -07:00
Eklavya Sharma
896c18a57b
email-mirror.py: Make it pass on mypy in python 3.
...
* Replace filter by list comprehension.
* Add '# type: ignore' to statements which use attributes from
modeule `posix`, since stubs for posix are missing on python 3.
2016-07-07 10:07:28 -07:00
Eklavya Sharma
17cb6e00bd
create_stream.py: Fix broken code.
...
* get_realm returns None if no matching realm is present, but
create_stream.py assumed it raises Realm.DoesNotExist.
* encoded/decode strings properly.
2016-07-07 10:06:39 -07:00
Eklavya Sharma
7956fcbf0d
zerver/lib/str_utils.py: Allow specifying encoding.
2016-07-07 10:06:22 -07:00
Eklavya Sharma
63d55bdd86
zerver/views/__init__.py: decode b64encoded ccache.
...
Convert b64encoded ccache to `str` before passing to
subprocess.check_call.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
628e45defc
zerver/lib/actions.py: Use text_type in truncate_ functions.
...
The functions truncate_content, truncate_body and truncate_topic
are only meant to be used on text strings. So change its
parameter types from AnyStr to text_type.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
976858f536
tornado_ioloop_logging.py: Ignore because of missing stub.
...
There is no stub for select.epoll on python 3. So ignore the
statement which uses it.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
9d2a539aaa
zerver/lib/notifications.py: Add hints for mypy.
...
Add type hints for mypy using isinstance in assert and if.
2016-07-07 10:02:08 -07:00
Tim Abbott
98db1d996f
email_mirror: Fix some indentation issues.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
5e81a4d93f
zerver/lib/email_mirror.py: Improve annotation in python 3.
...
Add asserts and if statements to help mypy.
2016-07-07 10:01:30 -07:00
Eklavya Sharma
4f221c21a0
zerver/lib/email_mirror.py: Improve subject extraction.
...
Improve subject extraction in process_message.
2016-07-07 09:55:23 -07:00
Eklavya Sharma
06a7a6caee
zerver/lib/debug.py: Remove from mypy's exclude_py3.
...
traceback.print_stack doesn't have a stub yet. So ignore the
statement which uses it.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
6bb266d262
bugdown's __init__.py: Add python 3 compatibility.
...
* Use Response.text instead of Response.content.
* Make unescaping work on python 3.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
05046d9288
bugdown's codehilite.py: Fix annotations in python 3 mode.
...
Many stubs in xml.etree.ElementTree use Union[str, bytes] as
return type. Mypy wants us to correctly handle each case. This
is correct, but not useful for us since we know that we'll always
get str. So force the return value to text_type, to supress mypy
errors.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
610f19c791
zerver/lib/camo.py: Type ignore statement with hex encode.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
6a63870136
zerver/decorator.py: Correctly encode/decode strings.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
4e698ab1f6
Remove zerver/lib/parallel.py from mypy's exclude_py3.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
ce6ddd574a
zerver/lib/test_helpers.py: Replace os.path.walk by os.walk.
...
os.path.walk has been removed in python 3.
2016-07-06 11:49:55 -07:00
Eklavya Sharma
6505cbf2bf
zerver/lib/timeout.py: Replace isAlive by is_alive.
...
In threading.Thread, isAlive has been removed in python 3.
We should use is_alive instead.
2016-07-06 11:49:48 -07:00
Eklavya Sharma
d8de54abe5
zerver/migrations: Squash an AlterField from 0002 into 0001.
...
Squash the AlterField on UserProfile.groups in 0002 into the
AddField in 0001. This is done to avoid a probable bug in Django,
where running migrations in python 3 sometimes led to a KeyError.
2016-07-06 11:40:12 -07:00
Umair Khan
47fb293f8a
i18n: Add English locale to language list if missing.
...
The English locale data is only present if the user has run `manage.py
makemigrations` on the system.
2016-07-06 11:34:28 -07:00
Eklavya Sharma
2d4dcd1698
Replace bytes by strings in zerver migrations 2, 13, 18.
2016-07-04 12:08:37 -07:00
Eklavya Sharma
6553e16b89
Replace bytes by strings in zerver/migrations/0001.
2016-07-04 12:08:37 -07:00
Umair Khan
035fceb814
Add dynamically loaded language dropdown.
2016-07-04 11:56:02 -07:00
Conrad Dean
bbf7a9c801
Annotate zerver/lib/event_queue.py.
2016-07-04 03:01:33 +05:30
Conrad Dean
9812e676f0
Annotate zerver/lib/queue.py.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
192663edcf
zerver/lib/narrow.py: Fix annotations.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
95b6e668a7
zerver/lib/actions.py: Fix annotations.
...
Change queue_ids from text_type to str.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
9772a512cb
Use abstract types in annotations.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
fdf4d67cde
zerver/tornado.py: Convert queue_id to str.
2016-07-04 02:58:57 +05:30
Eklavya Sharma
de19b24f74
zerver/lib/handlers.py: Fix an annotation.
2016-07-04 02:20:25 +05:30
Eklavya Sharma
4761cc27dd
zerver/middleware.py: Fix annotations.
...
* Use abstract types where relevant.
* Fix string types.
* Fix annotation of args and kwargs.
2016-07-04 02:14:42 +05:30
Eklavya Sharma
6d8ba90db9
zerver/models.py: Modify imports for mypy in py3 mode.
...
Change 'from zerver.lib import bugdown' to
'import zerver.lib.bugdown as bugdown' to make zerver/models.py
pass mypy check in python 3 mode.
2016-07-02 10:38:48 -07:00
Eklavya Sharma
b902c1ae45
bugdown: Replace raw unicode literal with non-raw.
...
Raw unicode literals are disallowed in python 3.
2016-07-02 10:38:48 -07:00
Kartik Maji
f8bb7503e6
Add ability to pin streams to top of the streams sidebar list.
...
Based on work by Lauren Long, with some tweaks by tabbott.
2016-06-30 22:26:09 -07:00
Kartik Maji
a32167d921
test_events: Sort subscribers list.
...
The subscribers list is appended to in `peer_add` events with not
regard for preserving the ordering, and ordering isn't really
important here, so it seems best to just sort it in these checks.
2016-06-30 16:52:51 -07:00
Vishnu Ks
1cbd39b768
Unique link generator for realm creation.
2016-06-30 15:52:41 -07:00
Alex Wilson
8c62cff1b7
bugdown: Clean up paths to emojis.
2016-06-30 15:48:02 -07:00
Alex Wilson
b040839c76
Add unicode emoji to frontend markdown parser.
...
Fixes 2nd half of #1011 .
2016-06-30 15:48:02 -07:00
Alex Wilson
5ec29101eb
Add unicode emoji support to bugdown.
...
Fixes half of #1011 .
2016-06-30 15:48:02 -07:00
Tim Abbott
0397855fdd
test_hooks: Use send_json_payload for private message tests.
2016-06-30 15:12:03 -07:00
Rishi Gupta
17b6d136d5
Add Semaphore webhook integration.
2016-06-29 16:36:19 -07:00
Eklavya Sharma
def8cd8e78
Annotate zerver/lib/timeout.py.
2016-06-29 10:41:01 -07:00
Eklavya Sharma
21f789eb05
zerver/lib/session_user.py: Replace Dict by Mapping.
2016-06-29 10:36:50 -07:00
Eklavya Sharma
b76dc9bf4e
zerver/lib/upload.py: Fix string types.
2016-06-29 20:43:28 +05:30
Tim Abbott
abc2c03b0f
Fix missing 'current_url' value in registration flow.
...
This fixes some tracebacks I got while testing the Zulip htpasswd SSO
functionality.
I think that this stopped working as a result of the Jinja2 migration.
2016-06-28 23:05:38 -07:00
Tim Abbott
56e7a2f6f3
Annotate zerver.migrations.
2016-06-28 16:38:33 -07:00
Eklavya Sharma
2cba2caa7f
zerver/lib/test_helpers.py: Fix string annotations.
2016-06-29 01:54:17 +05:30
Eklavya Sharma
d9eb711e5e
zerver/tests/test_helpers.py: Use text_type for api_keys.
...
Also encode/decode strings appropriately when using api_keys to generate
basic auth header.
Also fix clashing annotations in zerver/tests/test_external.py.
2016-06-29 01:50:38 +05:30
Eklavya Sharma
eb3bde40a0
zerver/lib/test_helpers.py: Improve type annotations.
2016-06-29 01:35:34 +05:30
Eklavya Sharma
97760702a8
zerver/lib/actions.py: Use Sequence as parameter type.
2016-06-29 01:11:41 +05:30
Eklavya Sharma
dca9256f3c
zerver/lib/socket.py: Improve annotations.
...
* Add Optional where required.
* Set type of req_redis_key as `(text_type) -> text_type` for consistency.
Almost all our cache keys and redis keys use this signature.
2016-06-29 00:45:13 +05:30
Eklavya Sharma
b305af05b3
Fix string annotations in custom cursors.
2016-06-28 15:58:57 +05:30
Eklavya Sharma
1a00b08a11
zerver/lib/db.py: Use a type alias to shorten annotations.
2016-06-28 15:57:43 +05:30
acrefoot
acd7ff7aff
Fix typo in Recipient comment.
2016-06-27 18:34:02 -07:00
acrefoot
a36e5d4987
Add get_auth_backends endpoint to API.
...
We would like to know which kind of authentication backends the server
supports.
This is information you can get from /login, but not in a way easily
parseable by API apps (e.g. the Zulip mobile apps).
2016-06-27 18:30:34 -07:00
Tim Abbott
e72f41cdec
Remove old prototype data import/export tool.
...
This prototype from Dropbox Hack Week turned out to be too inefficient
to be used for realms with any significant amount of history, so we're
removing it.
It will be replaced by https://github.com/zulip/zulip/pull/673 .
2016-06-27 13:47:08 -07:00
Tim Abbott
b2a24e0306
Revert "Add authorization check before serving files."
...
This reverts commit e985b57259
.
This commit will break production when we next do a release, because
we haven't done a migration to create Attachment objects for
previously uploaded files.
2016-06-27 12:09:56 -07:00
Tim Abbott
f7e87bc1f0
test_helpers: Require that login calls actually succeed.
...
This caught several bugs where test code wasn't doing what it's author
intended.
2016-06-27 11:51:04 -07:00
Tim Abbott
4cac7bbb32
test_helpers: Refactor login test helpers.
...
We now have a separate login helper for the case where the return
value is desired.
2016-06-27 11:50:43 -07:00
Tim Abbott
a05c03d3b5
test_messages: Fix trying to login as a bot user.
...
Due to a recent refactoring, the first user in the subscribers list is
now a bot.
2016-06-27 11:48:39 -07:00
Tim Abbott
370b38696a
test_messages: Fix broken huddle messages test.
...
The second login call was failing because the user didn't exist.
2016-06-27 11:48:36 -07:00
rahuldeve
e985b57259
Add authorization check before serving files.
2016-06-27 11:24:35 -07:00
rahuldeve
674def30ee
Add support for serving files using API authentication.
...
Also remove 'get_uploaded_file' view function and the corresponding
old '/user_upload/' url pattern.
2016-06-27 11:00:41 -07:00
rahuldeve
2bf15603f3
Modify rest_dispatch to support method specific flags.
...
[simplified substantially by tabbott]
2016-06-27 10:53:15 -07:00
rahuldeve
823bf15c6e
Add API route for uploading files.
2016-06-27 10:30:58 -07:00
Tim Abbott
79570f99c2
json_upload_file: Remove unnecessary has_request_variables.
2016-06-27 10:29:30 -07:00
Tim Abbott
8272fb4a94
zerver.views.upload: Move upload functions later in file.
2016-06-27 10:28:09 -07:00
Eklavya Sharma
f20699b615
zerver/lib/statistics.py: Fix annotations.
...
Add type annotation to a variable.
Use abstract base container types where suitable.
Add missing imports from typing.
2016-06-27 18:03:29 +05:30
Eklavya Sharma
3917b822e5
zerver/lib/bulk_create.py: Type annotate variables.
2016-06-27 17:52:37 +05:30
Eklavya Sharma
d7a83ed019
zerver/views/__init__.py: Type annotate a variable.
2016-06-27 17:52:37 +05:30
Eklavya Sharma
63a5323259
zerver/views/streams.py: Type annotate variables.
2016-06-27 17:52:22 +05:30
Eklavya Sharma
9aa6fd988a
zerver/lib/actions.py: Type annotate variables.
2016-06-27 17:52:07 +05:30
Eklavya Sharma
7ca1e658b5
zerver/lib/cache.py: Change some TypeVars to Any.
...
Change ItemT and CompressedItemT to Any.
See https://github.com/python/mypy/issues/1721 .
2016-06-27 16:50:50 +05:30
rahuldeve
a3745178e5
Use django.utils.autoreload to restart queue workers at code change.
...
Fixes #621 , #1045 .
2016-06-26 20:12:11 -07:00
dhanus
1169329a71
Annotate zerver/views/webhooks/github.py.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
85cb3e6103
zerver/views/webhooks/github.py: Make exception string str.
...
Passing a unicode string to Exception can sometimes fail.
Convert it to str to prevent that.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
a32f83b182
zerver/views/webhooks/github.py: Fix string literals.
...
Change some string literals to unicode.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
fa4adf0c62
zerver/views/webhooks/bitbucket.py: Fix an annotation.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
36c2214d94
zerver/views/webhooks/bitbucket.py: Fix string literals.
...
Convert some strings literals to unicode.
2016-06-26 08:13:49 -07:00
Max
9b6205d0ed
Annotate zerver/decorator.py.
2016-06-26 08:13:49 -07:00
Max
daab2ca475
zerver/tornadoviews.py: Improve an annotation.
...
Use django.core.handlers.base.BaseHandler instead of Any.
2016-06-26 19:05:54 +05:30
Tim Abbott
ce7c7d3510
Wrap youtube_re.
2016-06-25 10:52:03 -07:00
Tim Abbott
c25c8d8c98
forms: Wrap some very long lines.
2016-06-25 10:52:03 -07:00
Vishnu Ks
7d654a26c8
Casper test for realm creation.
2016-06-25 10:50:12 -07:00
Vishnu Ks
20adcbc64b
Make send_registration_completion_email return the Confirmation object.
2016-06-24 17:47:56 -07:00
Vishnu Ks
8350b89798
Add support for custom error message in realm-creation-failed template.
2016-06-24 17:47:56 -07:00
Tim Abbott
6d71c25a0f
accounts_register: Stop using _ as dummy variable.
...
This conflicts with internationalization.
2016-06-24 17:47:31 -07:00
acrefoot
e4ed9195dc
Remove rest_dispatch hack and optimize imports.
...
For a long time, rest_dispatch has had this hack where we have to
create a copy of it in each views file using it, in order to directly
access the globals list in that file. This removes that hack, instead
making rest_dispatch just use Django's import_string to access the
target method to use.
[tweaked and reorganized from acrefoot's original branch in various
ways by tabbott]
2016-06-24 16:11:03 -07:00
acrefoot
5d21fb0681
Remove unused imports from tornadoviews.py.
2016-06-24 14:53:13 -07:00
acrefoot
be484b25c6
Add comments on how rest_dispatch authenticates.
2016-06-24 14:52:22 -07:00
Tomasz Kolek
e6861636c8
Fix editing messages by adding or removing leading /me.
...
Previously, this did not correctly rerender the message to be (or not
to be) rendered as a /me style message.
Fixes : #835 .
2016-06-24 11:18:29 -07:00
rahuldeve
8cecb37743
Modify Attachment model to track file access permissions.
2016-06-23 17:46:16 -07:00
Vishnu Ks
574a304b12
Mention invite emails are printed in console in dev.
...
This is part 2 of #1046 .
2016-06-23 17:07:11 -07:00
Umair Khan
33e6b471e2
Fix spelling of mesage_count_by_recipient_subject.
2016-06-22 09:02:35 -07:00
Tim Abbott
250781e843
Fix HTTP Basic Auth popups caused by auth failures.
...
If a user's session cookie expired, the next REST API request their
browser did would go into the json_unauthorized code path. This
returned a response with a WWW-Authenticate tag for HTTP Basic Auth
(since that's what the REST API uses), even for /json requests which
should only be authenticated using session auth.
We fix this by explicitly passing the desired WWW-Authenticate state.
Fixes : #800 .
2016-06-21 16:18:36 -07:00
Tim Abbott
45beac7d6c
test_decorators: Add test for /json/fetch_api_key.
2016-06-21 16:14:22 -07:00
Tim Abbott
f39c9161fe
Fix fetching user API keys via settings page when using LDAP backend.
...
Previously, json_fetch_api_key was hardcoding a check using Zulip's
built-in password functionality, rather than using authenticate().
2016-06-21 14:58:25 -07:00
Tomasz Kolek
7aa45ffa45
Increase send_message_backend coverage.
2016-06-21 14:33:21 -07:00
Tim Abbott
50f723f50b
Split test_narrow.py out of test_messages.py.
2016-06-21 12:25:08 -07:00
Tomasz Kolek
e3e03e2946
Add NarrowBuilder test cases.
...
Refactor existing add_term test cases.
2016-06-21 11:53:31 -07:00
Tomasz Kolek
f8c368c07f
Add default-bot during populate_db.
2016-06-21 11:47:38 -07:00
Tomasz Kolek
9ae68ade8b
Add is_webhook option to authentication decorats.
...
Modified:
authenticated_rest_api_view
authenticated_api_view and validate_api_key.
2016-06-21 11:47:38 -07:00
Tim Abbott
80d92c1651
Add comment documenting confusing list_to_streams code.
2016-06-21 11:45:35 -07:00
krtkmj
9dadab6eac
Replace placeholder variables x with more meaningful ones.
2016-06-20 19:36:07 -07:00
medullaskyline
e2eb4e0b7e
Annotate zerver/lib/email_mirror.py.
...
[With some fixes from @sharmaeklavya2].
2016-06-20 15:58:40 -07:00
Eklavya Sharma
a2668a2853
zerver/lib/notifications.py: Fix an annotation.
2016-06-21 02:20:36 +05:30
Umair Khan
134b165b1a
Fix frontend translation string bug.
...
The translation string which contain \n are not captured
within {{#tr}}{{/tr}} blocks. Fix is to escape the slash.
2016-06-20 11:31:28 -07:00
Vishnu Ks
ff66ce780a
Mention emails are printed in run-dev.py console.
...
Fixes : #1046
2016-06-20 11:07:20 -07:00
Eklavya Sharma
aceee3da11
zerver/lib/rate_limiter.py: Annotate rate_limiter.rules.
...
After annotating rate_limiter.rules, mypy complained that rules does
not support cmp. So use key to customize sort instead of cmp.
Python docs also recommend using key over cmp.
2016-06-18 16:41:41 -07:00
Eklavya Sharma
13f62da4ce
zerver/lib/rate_limiter.py: Fix annotations.
2016-06-18 16:41:40 -07:00
Eklavya Sharma
6097f6eed5
zerver/lib/initial_password.py: Encode return value.
...
zerver.lib.initial_password.initial_password is supposed to return an
Optional[text_type], but it returns an Optional[binary_type] instead.
Encode the return value to make sure it returns an Optional[text_type].
2016-06-18 16:41:40 -07:00
Eklavya Sharma
018041625c
zerver/lib/html_diff.py: Fix annotations.
2016-06-18 16:41:40 -07:00
Eklavya Sharma
68823767e2
zerver/lib/digest.py: Fix annotations.
2016-06-18 16:41:40 -07:00
Eklavya Sharma
64ccb390ff
Annotate zerver/lib/create_user.py.
2016-06-18 16:41:40 -07:00
Vishnu Ks
ad1c3894d9
Add interface for creating new realms.
...
This is controlled by settings.OPEN_REALM_CREATION; if that setting is
off, this feature doesn't do anything.
2016-06-17 16:15:28 -07:00
Vishnu Ks
8213ca135a
Move default_stream list to settings.
2016-06-17 16:01:38 -07:00
kunall17
007eee6061
Add route to fetch emails for mobile passwordless login.
...
[Tweaked by tabbott to rename API to explicitly support not just
Android]
2016-06-17 11:03:19 -07:00
kunall17
7ea0eaed1c
Add passwordless login for mobile app development.
...
[Tweaked by tabbott to rename API to explicitly support not just
Android].
2016-06-17 10:58:33 -07:00
Vishnu Ks
01c9bb2d5e
Make name_changes_disabled() work with no argument.
2016-06-16 17:13:59 -07:00
Tomasz Kolek
76cbe89613
Add IFTTT integration.
2016-06-16 15:30:45 -07:00
Eklavya Sharma
598fb1ff28
zerver/lib/bugdown/fenced_code.py: Add BaseHandler.
...
Add a class 'BaseHandler' and make it a base class of OuterHandler,
QuoteHandler and CodeHandler. This will help annotate some functions
and improve type checking.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
142bcadb68
Annotate zerver/lib/bugdown/fenced_code.py.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
9b72b7b37e
Annotate zerver/lib/bugdown/codehilite.py.
...
Also change some string literals to unicode.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
744007f33f
zerver/lib/bugdown/__init__.py: Fix string types.
...
Change important string constants from str to text_type.
Replace str by text_type in annotations where relevant.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
04f44b12ad
zerver/lib/bugdown/testing_mocks.py: Fix types.
...
Also fix clashing annotations in zerver/lib/bugdown/__init__.py.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
7db0765a18
zerver/lib/bugdown/fenced_code.py: Fix types.
...
Change some important string literals from str to unicode.
Annotate format_code and codehilite_conf in FencedBlockProcessor.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
48c5b299b6
zerver/lib/bugdown/codehilite.py: Add type annotation.
...
Mypy incorrectly infers a dict's type as `Dict[str, List[object]]`.
Change that to `Dict[str, List[Any]]`.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
a485d63975
zerver/lib/bugdown/__init__.py: Fix non-string annotations.
2016-06-16 15:21:17 -07:00
Tim Abbott
eafb91719c
get_tweet_id: Fix return type to by None.
2016-06-16 15:21:01 -07:00
Tim Abbott
33df0b29d3
Annotate zerver/tests/test_hooks.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
49ae0052b2
send_json_payload: payload arg can be text_type.
2016-06-16 14:07:34 -07:00
Tim Abbott
df9f89fe2c
test_helpers: Change send_json_payload to use text_type.
2016-06-16 14:07:34 -07:00
Tim Abbott
b14eacd552
test_helpers: Change fixture_data to text_type.
2016-06-16 14:07:34 -07:00
Tim Abbott
5b05644c95
Run mypy on zerver/tests/test_hooks.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
6723525fd3
Annotate zerver/tests/tests.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
45883386ce
AlertWordTests: Cleanup confusing message variable reuse.
2016-06-16 13:55:58 -07:00
John Hergenroeder
16a19226f6
Add linter check for redundant REQ whence argument.
2016-06-16 13:53:39 -07:00
Eklavya Sharma
98553e8caa
zerver/lib/push_notifications.py: Fix strings.
...
Use appropriate string encode/decode operations and fix annotations.
2016-06-15 15:25:28 -07:00
Eklavya Sharma
78565a96c9
zerver/lib/notifications.py: Fix string annotations.
2016-06-15 15:25:28 -07:00
Tim Abbott
10dd9addb7
Fix ChangeSettingsTest caching issue causing test failures.
2016-06-15 14:57:58 -07:00
Tim Abbott
06079042d4
ChangeSettingsTest: Move login to test helper method.
2016-06-15 14:28:24 -07:00
Tim Abbott
8f67b7e498
Simplify check_for_toggle_param.
2016-06-15 14:23:51 -07:00
Ashish Kumar
0a98d9edcf
Add test_enter_sends_setting.
2016-06-15 14:23:51 -07:00
Ashish Kumar
8a55098ca7
Add test_time_setting.
2016-06-15 14:23:51 -07:00
Ashish Kumar
345df3538f
Add test_toggling_left_side_userlist.
2016-06-15 14:23:51 -07:00
Ashish Kumar
24767302c4
Update test_ui_settings to use new abstraction.
2016-06-15 14:23:51 -07:00
Ashish Kumar
006e528e18
Update test_notify_settings to use new abstraction.
2016-06-15 14:23:51 -07:00
Ashish Kumar
5ae06e8c33
Added test helper function: check_for_toggle_param
2016-06-15 14:18:55 -07:00
Tim Abbott
f88e5b7438
Add missing no-op migration for realm_emoji.
...
Because of how Django's migration system works, changing the error
message attached to a model field's validator results in an extra
migration.
2016-06-15 09:26:01 -07:00
Umair Khan
a976ccefbf
[third] Urlencode name of the uploaded file.
...
Update jquery-filedrop to send urlencoded filenames.
As discussed in https://github.com/zulip/zulip/pull/1023 , this fix is
already in jquery-filedrop upstream.
Fixes #981 .
2016-06-14 15:32:41 -07:00
Tomasz Kolek
4e51a86ea4
Add updownio integration.
2016-06-14 12:14:07 -07:00
Tomasz Kolek
14d69348d3
Add Airbrake integration.
2016-06-13 20:36:40 -07:00
Eklavya Sharma
72ed1f4187
Fix python 3 pyflakes error.
...
Change raw unicode literal to non-raw. A raw unicode literal is a
syntax error in python 3. This error was detected by pyflakes.
2016-06-13 19:44:56 -07:00
Tim Abbott
2219ef7bef
bugdown: Rename upload_re to upload_title_re for clarity.
2016-06-13 19:44:56 -07:00
Tim Abbott
6c78036811
Add tests for upload title functionality.
2016-06-13 19:44:56 -07:00
Tim Abbott
5b1cfbc977
bugdown: Fix extraction of titles for uploaded files.
...
The previous code was associated with a previous version of the upload
URL naming scheme, and thus never triggered in practice.
2016-06-13 19:44:51 -07:00
Umair Khan
c8d139b2b1
Fix emoji urls interaction with i18n.
...
When accessing emojis with relative urls we should start the urls with
a slash so that language code doesn't become part of these urls.
Fixes #1014 .
2016-06-13 09:10:11 -07:00
Umair Khan
6fcfed8d9e
Update regexes to capture translation strings.
...
Strings are captured from:
- i18n.t
- compose_error
- placeholder
2016-06-13 09:03:56 -07:00
Eklavya Sharma
7ec9cb7e93
Annotate model fields: Attachment.
...
Also fix clashing annotations.
2016-06-13 20:01:03 +05:30
Eklavya Sharma
86978cb2a3
Annotate model fields: Stream.
2016-06-13 20:01:03 +05:30
Eklavya Sharma
6f5ed6e7c9
Fix annotations clashing with Stream model fields.
2016-06-13 20:01:02 +05:30
Eklavya Sharma
1ec7e124c7
Annotate model fields: Message.
2016-06-13 20:01:02 +05:30
Eklavya Sharma
5a5934a76f
Fix annotations clashing with Message model fields.
2016-06-13 20:01:02 +05:30
Eklavya Sharma
f27cff57c3
Annotate model fields: UserProfile.
2016-06-13 20:01:02 +05:30
Eklavya Sharma
71e613424b
Fix annotations clashing with UserProfile's model fields.
2016-06-13 20:01:01 +05:30
Eklavya Sharma
9d7a2fdf9d
zerver/views/streams.py: Fix annotations.
...
Mainly fix `str` to `text_type` and use abstract containers.
2016-06-13 20:01:01 +05:30
Eklavya Sharma
9f39c9276f
Annotate model fields: DefaultStream, Referral, ScheduledJob.
2016-06-13 19:37:07 +05:30
Eklavya Sharma
4f890cca2a
Annotate model fields: UserActivity, UserActivityInterval, UserPresence.
2016-06-13 19:37:07 +05:30
Eklavya Sharma
7290f9cb83
Annotate model fields: Subscription and Huddle.
2016-06-13 19:37:07 +05:30
Eklavya Sharma
ddaaa98b25
Annotate model fields: UserMessage.
2016-06-13 19:30:58 +05:30
Eklavya Sharma
acd1767398
Annotate model fields: Recipient and Client.
2016-06-13 19:30:57 +05:30
Eklavya Sharma
c0004a5874
Annotate model fields: PushDeviceToken and MitUser.
2016-06-13 19:30:57 +05:30
Eklavya Sharma
04740fb620
Annotate model fields: PreregistrationUser.
2016-06-13 19:30:56 +05:30
Eklavya Sharma
d666e00833
Annotate model fields: RealmEmoji and RealmFilter.
2016-06-13 19:30:56 +05:30
Eklavya Sharma
6c7dd07ec2
Annotate model fields: Realm and RealmAlias.
2016-06-13 19:30:56 +05:30
Eklavya Sharma
d169cc5376
zerver/lib/bulk_create.py: Fix string annotations.
...
Change string type from `str` to `text_type` where required.
Also fix clashing annotations.
2016-06-13 10:08:14 +05:30
Eklavya Sharma
c654c4032d
zerver/models.py: Annotate get_display_recipient.
...
get_display_recipient's annotation clashes with other wrong annotations.
Fix those wrong annotations.
Since get_display_recipient returns a Union, use isinstance checks and
casts to make mypy checks succeed.
2016-06-12 23:34:57 +05:30
Eklavya Sharma
ed61c4c581
Improve model string representation.
...
Define __str__, __repr__ and __unicode__ correctly on models.
This will help in python 3 compatibility.
2016-06-12 09:55:12 -07:00
Eklavya Sharma
17b9422546
zerver/models.py: Fix regex strings.
...
Some regex strings were not declared as raw, even though they used
a lot of backslashes.
2016-06-12 09:31:19 -07:00
Eklavya Sharma
81759d56be
zerver/models.py: Fix string annotations in UserPresence.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
e11bec28c2
zerver/models.py: Fix annotations (str -> text_type).
...
Change str to text_type where appropriate in annotations related to
Attachment, PreregistrationUser and Huddle.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
d76bea8f25
zerver/models.py: Identify functions returning QuerySets.
...
Identify functions which return QuerySets and give them a return type
`Sequence` with appropriate parameter. Typing them as QuerySet will
not be useful since generic stubs for QuerySets are not available and
not knowing the type of QuerySets is hardly useful for type checking.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
39060aa221
zerver/models.py: Fix annotations related to Message.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
2841aa642d
Fix annotations related to make_safe_digest and hashes.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
9020177418
zerver/models.py: Add annotations related to Stream and Client.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
10f2ec043d
Fix zerver.lib.utils.generate_random_token.
...
generate_random_token used to return a value of type six.binary_type
and its return type was annotated as `str`. This commit fixes that
by making it return a value of type `six.text_type` and updating
the annotation accordingly.
Also fix clashing annnotations.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
56d5785c2e
zerver/models.py: Change some constants to unicode literals.
...
Change choices of UserProfile.avatar_sources and UserProfile.tutorial_status
from str literals to unicode literals. This is done because these fields
are CharFields, which are of type `six.text_type`. So the set of values
which they can take should also be of the type `six.text_type`.
Also fix clashing annotations.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
0cc7a6583c
zerver/models.py: Fix last_reminder_tzaware annotation.
...
Fix annotated return type of UserProfile.last_reminder_tzaware from
`str` to `Optional[datetime.datetime]`.
2016-06-12 09:30:33 -07:00
Eklavya Sharma
8acc51218e
Fix realm emoji and realm filter annotations.
...
Change `str` to `text_type` in annotations in zerver/models.py
related to realm emoji and realm filters.
Also fix clashing annotations in zerver/lib/bugdown/__init__.py.
2016-06-12 09:25:42 -07:00
Eklavya Sharma
e68d99eb2e
zerver/models.py: Make cache_keys text_type.
2016-06-12 09:25:32 -07:00
Babak
ad895eb690
Annotate zerver/views/report.py.
2016-06-11 18:42:37 -07:00
Vishnu Ks
77ec6217eb
Add validation for private message recipients.
...
The function will reject messages where recipients aren't either a
member of the realm or a member of cross_realm_user_emails.
Fixes : #930 .
2016-06-11 11:24:45 -07:00
Tim Abbott
f44b227b85
Refactor getting cross-realm users into a function.
2016-06-11 11:22:22 -07:00
Eklavya Sharma
f82b28e835
zerver/lib/cache.py: Fix get_cache_backend's annotation.
2016-06-11 09:12:58 -07:00
Eklavya Sharma
0b2d1c30e9
zerver/lib/cache.py: Replace Any with appropriate models.
...
Due to a cyclic dependency issue, functions having models as parameters
were annotated as Any.
That issue is fixed by importing models inside an `if False:` block,
so that mypy sees them but they are not imported at runtime.
2016-06-11 09:12:58 -07:00
Eklavya Sharma
ff4e95d941
Improve generic_bulk_cached_fetch annotation using TypeVars.
2016-06-11 09:12:42 -07:00
Eklavya Sharma
d27a0e162a
zerver/lib/cache.py: update_user_profile_caches return type is None.
...
In update_user_profile_caches, the return type in annotation was
marked as Any. Change that to None because, nothing is being returned
in that function.
2016-06-11 09:11:52 -07:00
Eklavya Sharma
53084fe03c
Use text_type as type of cache keys and update users.
...
This changes the type annotations for the cache keys in Zulip to be
consistently text_type, and updates the annotations for values that
are used as cache keys across the codebase.
2016-06-11 09:10:34 -07:00
Eklavya Sharma
d3b80d94a2
Use appropriate string types and correctly encode/decode them.
2016-06-11 17:34:23 +05:30
Eklavya Sharma
f18493f922
Add documentation about zerver/lib/str_utils.py.
2016-06-11 17:31:56 +05:30
Eklavya Sharma
6d29da8cee
Add zerver/lib/str_utils.py.
...
str_utils.py has functions for converting strings from one type to
another. It also has a TypeVar called NonBinaryStr, which is like AnyStr
except that it doesn't allow bytes.
2016-06-11 16:17:47 +05:30
Vishnu Ks
b926826ea1
Remove default_stream addition and deletion from update_stream_backend.
...
Default stream addition/removal is done via the /default_stream REST
endpoints.
2016-06-10 16:59:15 -07:00
Tim Abbott
7c80456321
Fix and re-enable test_file_upload_authed.
...
Now that we have a working S3 mock and an effective way to toggle the
upload backend that Zulip is using, we can re-enable this important
end-to-end test of the Zulip S3 upload backend.
2016-06-09 23:07:24 -07:00
rahuldeve
fa13582ffb
Serve uploaded files through get_uploaded_file in development.
...
Previously, uploaded files were served:
* With S3UploadBackend, via get_uploaded_file (redirects to S3)
* With LocalUploadBackend in production, via nginx directly
* With LocalUploadBackend in development, via Django's static file server
This changes that last case to use get_uploaded_file in development,
which is a key step towards being able to do proper access control
authorization.
Does not affect production.
2016-06-09 22:58:25 -07:00
Tim Abbott
719e5487b9
upload: Use classes to define S3/Local upload backends.
...
This has no functional changes; we just replace the old hacky
assignment of functions with assignment of the upload backend to a
variable.
I'm not totally happy with this, because we end up having to copy the
type annotations of the three methods 4 times each, but this should
make it a lot easier to test the (non-default-in-tests) S3 backend
using end-to-end tests, which would have caught
13bac1cc2a
.
I expect we'll iterate on the interface over time; ideally, I'd like
all the code that checks LOCAL_UPLOADS_DIR to be inside upload.py, and
primarily in these classes.
2016-06-09 22:45:03 -07:00
Tim Abbott
13bac1cc2a
Fix serving files uploaded to S3.
...
This was broken by the refactoring to realm_id_str in:
a261a6bbac
.
2016-06-09 21:55:50 -07:00
rahuldeve
3e3462da0d
Refactor zerver.lib.upload.upload_message_image_through_web_client.
...
upload_message_image_through_web_client -> upload_message_image_from_request
2016-06-09 21:09:12 -07:00
medullaskyline
39eaf02b40
Annotate zerver.views.webhooks.taiga.
2016-06-09 17:08:55 -07:00
Eklavya Sharma
286d23734a
zerver/lib/cache.py: Remove unneeded return statements.
2016-06-09 16:57:11 -07:00
Vishnu Ks
f9f31b79d0
Make default_streams web controllable.
...
Fixes : #665
2016-06-09 15:24:32 -07:00
rahuldeve
ed83bb7f54
Refactor zerver.views.upload.
2016-06-08 09:49:14 -07:00
rahuldeve
23ff717bee
Fix annotations: zerver.lib.upload.
2016-06-08 09:49:14 -07:00
Tim Abbott
e14732a12c
Remove unused test_beankstalk_message function.
2016-06-07 21:27:29 -07:00
Tomasz Kolek
2ac9c792f3
test_hooks: Use an incoming webhook bot for webhook tests.
2016-06-07 21:27:04 -07:00
Tomasz Kolek
999093b227
Add new is_incoming_webhook bot type.
...
This type of bot is only able to send messages via webhook endpoints.
2016-06-07 21:23:35 -07:00
Hyunchel Kim
b0702c62fc
Annotate zerver.views.messages partially.
2016-06-07 21:09:30 -07:00
Nathan Florea
6bcb6c3192
Removed some unused imports.
2016-06-07 18:13:58 -07:00
Nathan Florea
f11eee8b41
Remove redundant file open.
...
Calling open() with mode 'w' or 'a' will create a file if it doesn't exist,
while mode 'r' will cause an exception. This can be easily tested with:
python -c 'open("test.tmp", "w")'
ls test.tmp
2016-06-07 18:10:44 -07:00
Conrad Dean
fe2c352ac0
ClientDescriptor: Pass inline sets, not lists, to do_gc_event_queues.
...
This allows us to more precisely type do_gc_event_queues.
2016-06-07 13:28:45 -07:00
Conrad Dean
d77c70220c
send_event: Remove useless return value and annotate.
...
Detected by mypy.
[tweaked by tabbott to pass mypy check and remove annotations]
2016-06-07 13:27:40 -07:00
Conrad Dean
a4704ba8b2
event_queue: Fix deque values type annotation.
...
Event IDs in here are ints, as shown by the prune operation.
2016-06-07 13:05:46 -07:00
Umair Khan
5becd53414
Add tests for json_error and JsonableError.
2016-06-07 12:41:59 +05:00
Tim Abbott
bc2961d3ac
Refactor file upload routes to their own file.
2016-06-06 16:09:05 -07:00
Vishnu Ks
f3a8962612
Replace make_dict() with stream.to_dict().
2016-06-06 14:46:12 -07:00
Evan Palmer
8afeb7d8ce
Annotate webhooks/transifex.py, webhooks/yo.py.
2016-06-05 17:01:53 -07:00
Daw-Ran Liou
7f0709b65c
Annotate zerver.views.webhooks.freshdesk
...
Change the comments into docstrings.
Modified the return type of parse_freshdesk_event to always return a
list of str.
2016-06-05 15:56:27 -07:00
Dalek-Sec
c457f551ea
Annotate zerver/views/webhooks/crashlytics.py
2016-06-05 15:54:13 -07:00
medullaskyline
7e30de04ca
Annotate zerver.views.webhooks.pingdom.
2016-06-05 15:52:53 -07:00
medullaskyline
4c1da236ad
Annotate zerver.views.webhooks.pagerduty.
2016-06-05 15:47:33 -07:00
Daw-Ran Liou
4428287846
Annotate zerver.views.webhooks.stash.
2016-06-05 15:42:25 -07:00
Hyunchel Kim
b79cad0404
Annotate zerver.views.webhooks.teamcity
2016-06-05 15:11:45 -07:00
Daw-Ran Liou
26d067fc97
Annotate zerver.views.webhooks.pivotal.
2016-06-05 14:57:53 -07:00
medullaskyline
2369d48a9b
Annotate zerver.views.webhooks.newrelic.
2016-06-05 14:52:20 -07:00
Evan Palmer
4bf81b58b4
Annotate zerver/views/webhooks/zendesk.py.
2016-06-05 14:50:52 -07:00
Hyunchel Kim
de34dd1187
Annotate travis webhoook function.
2016-06-05 14:46:26 -07:00
medullaskyline
158914aa98
Annotate zerver.views.webhooks.jira.
2016-06-05 14:36:39 -07:00
Hyunchel Kim
bc87685ea6
bitbucket: Correct return type in annotation.
2016-06-05 14:33:31 -07:00
Daw-Ran Liou
70f44c00b0
check_send_message: Replace args/kwargs with explicit args.
...
This lets us actually type-checks the various views that are using
check_send_message.
2016-06-05 14:30:38 -07:00
Max
86fb6467e7
Add annotations to avatar.py, db.py, logging_util.py, unminify.py.
...
Also, fixed a a small type annotation in users.py because email must
be a string because emails don't support UTF-8 at this time (according
a comment in gravatar_hash in avatar.py).
2016-06-05 12:38:20 -07:00
medullaskyline
2855c285b4
Annotate zerver.forms.
2016-06-05 12:02:19 -07:00
Daw-Ran Liou
90a2dead46
Annotate zerver/views/webhooks/deskdotcom.py.
2016-06-05 11:53:44 -07:00
Deborah Hanus
a261a6bbac
Annotate zerver/views/__init__.py.
...
Also fix typing errors in a few related files.
[with tweaks from tabbott]
2016-06-05 11:34:19 -07:00
Daw-Ran Liou
c9bb93b0d2
Annotate zerver/views/webhooks/beanstalk.py.
2016-06-05 10:54:23 -07:00
Tim Abbott
15b2dd085e
Annotate zerver.lib.test_runner.
2016-06-04 23:23:31 -07:00
Tim Abbott
1ca7c3378b
Annotate zerver.lib.testing_mocks.
...
Also fix some annotations in bugdown to match.
2016-06-04 22:54:49 -07:00
Tim Abbott
157a3efb78
Annotate zerver.exceptions, zerver.filters, zerver.logging_handlers.
2016-06-04 22:51:18 -07:00
Conrad Dean
33dee43179
Annotate zerver/lib/socket.py.
...
Currently this uses a Union type for connection_id; we need to figure
out what actually sets that and what its type is and fix that later
(see https://github.com/zulip/zulip/issues/896 ).
2016-06-04 22:36:03 -07:00
Dalek-Sec
2bcf313a85
Added MyPy types to zerver/views/webhooks/codeship.py
2016-06-04 22:03:41 -07:00
medullaskyline
47c3ec1283
Annotate zerver.lib.upload.
2016-06-04 19:13:03 -07:00
Umair Khan
1bfe566c8d
[i18n] Make Json error messages translatable.
2016-06-04 18:48:36 -07:00