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