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
medullaskyline
c5f0d5b40a
Annotate zerver.middleware.
2016-06-04 18:32:06 -07:00
Tim Abbott
9c5f15e89b
models: Fix use of non-lazy ugettext at import time.
...
Was introduced in 03debdf82f
.
2016-06-04 17:46:03 -07:00
Daw-Ran Liou
0265968ea2
Annotate zerver/views/user_settings.
2016-06-04 17:41:59 -07:00
Reid Barton
cf93c8bce0
Annotate zerver/views/webhooks/bitbucket.py.
2016-06-04 17:02:59 -07:00
Daw-Ran Liou
8bbd93011d
Annotate zerver/views/users.py.
2016-06-04 17:00:53 -07:00
medullaskyline
fcdcccb5df
Annotate zerver.lib.digest.
2016-06-04 16:20:18 -07:00
Tim Abbott
d9d0515d3b
Add mypy bug number for check_redis type: ignore.
2016-06-04 16:11:18 -07:00
medullaskyline
7c2c7fb31c
Annotate zerver/lib/bulk_create.py.
2016-06-04 15:51:05 -07:00
Tomasz Kolek
8411b2e574
Add Crashlytics integration.
2016-06-04 15:18:42 -07:00
Tomasz Kolek
093e5a96d4
Add Transifex integration.
...
Fixes : #810 .
2016-06-04 14:52:57 -07:00
Max
04e2745136
Annotate debug.py, initial_password.py, narrow.py, response.py.
...
Also, fixed up the annotations for tornadoviews to better align with
how narrows was defined as `Iterable[Sequence[str]]` rather than
`List[Tuple[str, str]]`.
2016-06-04 12:56:36 -07:00
medullaskyline
7b2db95d02
Annotate zerver/lib/ccache.py.
2016-06-04 12:19:34 -07:00
Tim Abbott
6fba0879a4
Annotate much of the rest of zerver/tests.
2016-06-04 11:53:20 -07:00
Tim Abbott
27e9d3f06b
Annotate test_external and test_signup.
2016-06-04 11:53:20 -07:00
Tim Abbott
966375d74c
Annotate test_events, test_realm_emoji, test_uploads.
2016-06-04 11:53:20 -07:00
Tim Abbott
f1d58e767b
Annotate zerver/tests/test_subs.py.
...
This required a number of unique-related changes to test_helpers.
2016-06-04 11:53:10 -07:00
Tim Abbott
6f69053911
Annotate most of the rest of bugdown.
2016-06-04 11:35:29 -07:00
Max
c8dc033c3c
Annotate camo.py, mandrill_client.py, query.py, session_user.py
2016-06-04 11:28:42 -07:00
Tim Abbott
a1a27b1789
Annotate most Zulip management commands.
2016-06-04 10:12:06 -07:00
Tim Abbott
c2bea0fa08
zulip_finish: Remove useless return statement.
2016-06-04 10:06:31 -07:00
Tim Abbott
ac3989c114
models: Add most missing type annotations.
2016-06-04 00:03:54 -07:00
David Adamec
9e8ea93d3d
Add annotations for zerver/lib/validator.
2016-06-03 23:53:49 -07:00
David Adamec
4f3c85a20c
Add type annotations to zerver/lib/rest.
2016-06-03 23:48:46 -07:00
Conrad Dean
e7f0698884
Annotate zerver/lib/notifications.py.
2016-06-03 23:45:29 -07:00
Tim Abbott
7fd2956f29
clear_followup_emails_queue: Rename confusing local variable.
2016-06-03 23:45:29 -07:00
medullaskyline
cb84f72f2d
Annotate zerver/lib/html_diff.py.
2016-06-03 23:21:26 -07:00
Tim Abbott
2ec0114079
test_bugdown: Add tests for mentions.
2016-06-03 23:18:39 -07:00
Tim Abbott
cfff4f1d49
test_bugdown: Add a bugdown test for alert_words functionality.
2016-06-03 23:18:39 -07:00
Tim Abbott
8c757292cf
test_bugdown: Add test for nonmatching realm filters.
2016-06-03 23:18:39 -07:00
Tim Abbott
3a0eb01dda
test_messages: Fix huddle test failing when not on Internet.
2016-06-03 23:18:39 -07:00
Tim Abbott
e89730dc8f
subject_links: Remove useless RealmFilter.DoesNotExist case.
2016-06-03 23:18:39 -07:00
Tim Abbott
68fba3579d
test_bugdown: Add testing of subject_links feature.
2016-06-03 23:18:39 -07:00
gregmccoy
d77e8df3fa
Add tests for zerver/views/realm_emoji.py.
2016-06-03 23:12:53 -07:00
Tim Abbott
03debdf82f
Fix malformed error message when creating invalid Realm Emoji.
...
Thanks to Greg McCoy for his help finding this bug.
2016-06-03 23:12:36 -07:00
David Adamec
8ad20e9775
mypy type annotations for zerver/lib/utils
2016-06-03 22:58:15 -07:00
Tim Abbott
1552b9308b
Fix apnsclient import to match version 0.1.8 used in production.
...
Apparently, apnsclient moved Connection to a different module between
0.1.8 and 0.2.1.
2016-06-03 19:28:36 -07:00
Max
0f4673ae3b
Add type annotation to mention.py, redis_utils.py, timestamp.py, user_agent.py
...
Some functions in models.py had input typed as int when they needed to be typed as datetime.datetime
2016-06-03 19:00:16 -07:00
Max
1148f6ff8a
Rename timestamp kwarg in to_presence_dict to dt
...
It is not a timestamp, it is a datetime object. This is better ducktyping
2016-06-03 19:00:16 -07:00
Tim Abbott
654bd663aa
bugdown: Add annotations for a few more functions.
...
This resolves the issue with Typeshed #244 by making `upload_re` start
with `ur`.
2016-06-03 18:11:53 -07:00
Tim Abbott
f97b025a33
push_notifications: Fix incorrect Connection import.
2016-06-03 18:11:53 -07:00
medullaskyline
303bd21068
Annotate zserver.lib.push_notifications.
2016-06-03 17:45:54 -07:00
Oren Leaffer
2916fb30cb
bugdown: add some type annotations.
...
Had to add some "type: ignore" because the pattern used in match
doesn't affect the type returned. A fix for this issue has been pushed
to typeshed - https://github.com/python/typeshed/pull/244
2016-06-03 17:03:52 -07:00
medullaskyline
2213a9f41f
Annotate zerver/lib/cache_helpers.py
2016-06-03 16:34:30 -07:00
Conrad Dean
7f61a5e862
Add type annotations to zerver.lib.test_helpers.
2016-06-03 12:17:26 -07:00
Max
a6e60419c4
Add types to confirmation/views.py and zerver/tornadoviews.py
2016-06-03 11:26:30 -07:00
Vishnu Ks
4fd569f910
Change add_default_stream method from PATCH to PUT.
...
This is more consistent with our other routes.
2016-06-03 09:52:51 -07:00
Nathan Florea
04c71fadc6
More removal of mutable default arguments.
...
I've left a few that clearly aren't being passed and aren't being mutated, but
I think I've gotten the rest of them.
2016-06-03 09:17:04 -07:00
Nathan Florea
5fe9076631
Remove some mutable default arguments.
...
These ones don't fix any bugs, because the mutable arg is never passed
outside of the callable or mutated. But it's good practice to not use
them in case those invariants are changed in the future.
2016-06-03 09:16:56 -07:00
Ashish Kumar
9b990e3bd0
Type annotation of zerver/views/alert_words.
...
[Tweaked by tabbott to annotate the REQ variables the new way]
2016-06-03 08:07:58 -07:00
Ashish Kumar
31bf6b8259
Type annotation of zerver/models.py
...
[Substantially revised by tabbott]
This probably still has some bugs in it, but having mostly complete
annotations for models.py will help a lot for the annotations folks
are adding to other files.
2016-06-02 23:28:34 -07:00
Tim Abbott
37015fd7c5
Run mypy on zerver/lib/test_auth_backends.py.
2016-06-02 23:01:15 -07:00
Tim Abbott
8cef9675c8
Run mypy on zerver/lib/test_events.py.
2016-06-02 23:00:04 -07:00