Eeshan Garg
9d9988d368
webhooks/librato: Rewrite docs to conform to style guide.
2018-05-20 10:14:03 -07:00
Yashashvi Dave
38db31779b
/json/bots: Return "No user" if access other realms bot.
...
Instead of returning warning "Insufficient Permission", return
"No such bot" warning if user tries to access other realms bot."
2018-05-18 15:20:43 -07:00
Yashashvi Dave
4162e61f33
/json/users: Replace email with user_id in API to reactivate user.
2018-05-18 15:20:43 -07:00
Yashashvi Dave
06e7e933cc
/json/users: Replace email with user_id in API to update/remove users.
2018-05-18 15:20:43 -07:00
Tim Abbott
b8e2339a65
test_presence: Update debugging print statements.
2018-05-18 15:20:15 -07:00
jkiely
aa8248e734
mypy: Enable strict optional for check redis management command
...
Removed the error handling on the get_user_profile_by_id function, as it
would have just caused a different error shortly after.
2018-05-17 13:44:35 -07:00
Tim Abbott
3006b3f52f
url_preview: Fix crash when description has no content.
...
There's several things we'll want to cleanup with this feature, but
for now we're content to just make this not crash.
2018-05-17 12:40:43 -07:00
jkiely
058ee1ce1e
mypy: Enable strict optional on lib/soft_deactivation.
...
Tweaked by tabbott to add assert statements, rather than new
conditionals.
2018-05-17 12:13:53 -07:00
Tim Abbott
d4119d0198
initialize_voyager_db: Do nothing if a realm already exists.
...
This should help avoid confusing error messages for anyone
accidentally running this twice.
In particular, this also makes it easier to run Zulip inside
Kubernetes, since one doesn't need to worry about duplicate calls.
2018-05-17 11:38:09 -07:00
jkiely
104fdd8bf9
mypy: enable strict optional for lib/message.
...
Add assert in order to pass checks under strict conditions.
2018-05-17 11:12:08 -07:00
jkiely
04c50cffa7
mypy: Enable strict optional in zerver/lib/bugdown.
...
Explicitly check for none in optional value and set it to a dict.
2018-05-17 11:12:01 -07:00
jkiely
b3d43df498
mypy: Enable strict optional for lib/exceptions.
...
Change return type of reduce_ex to pass under stricter conditions.
2018-05-17 11:11:58 -07:00
jkiely
ca3ce90496
mypy: Enable strict optional in lib/avatar.py.
...
Add assert to function and modify tests in order to pass under
strict conditions.
2018-05-17 11:11:55 -07:00
jkiely
a1b5e7d6d5
mypy: Enable strict optional in lib/events.
...
Modify one variable assignment to pass under strict conditions.
2018-05-17 11:11:53 -07:00
jkiely
ad065fde29
mypy: Enable strict optional for lib/notifications.
...
Modify fix_emojis function to pass under strict conditions.
2018-05-17 11:11:49 -07:00
Tim Abbott
d782927b4c
test_webhooks_common: Add logging for a test flake case.
...
This seems to happen occasionally in CI, and we don't know why.
2018-05-17 09:18:31 -07:00
Vishnu Ks
372e9740ac
events: Add date_joined to user_dict.
2018-05-17 07:49:35 -07:00
Vishnu Ks
47b0a0d843
queue: Remove unused enqueue_welcome_emails import.
2018-05-17 07:45:37 -07:00
Tim Abbott
fc32fe16c6
test_presence: Add debugging output to help track down a flake.
...
This test has been failing nondeterministically, and the debug output
should help us figure out why.
2018-05-17 07:44:46 -07:00
Rishi Gupta
847e13cd54
push bouncer: Fix instructions in register_server.py.
2018-05-17 04:50:33 -07:00
Steve Howell
8812dba57e
Add server-side widget support for poll/tictactoe.
2018-05-16 15:13:33 -07:00
Steve Howell
1f0ffdc415
Add widget.py to enable widgets on the server side.
...
The only slash command implemented in this initial
version is an extremely crippled version of a
"/stats" slash command that reports that you are
running 1 server.
2018-05-16 15:13:33 -07:00
Steve Howell
de47eeb6f1
Add /submessage endpoint.
2018-05-16 15:13:33 -07:00
Steve Howell
4332fd64f7
Add submessages to message payloads.
2018-05-16 15:13:33 -07:00
Steve Howell
ff097623fa
Add SubMessage table.
2018-05-16 15:13:33 -07:00
Shubham Padia
4d70d032bc
populate_db: Make is_web_public default to False.
...
Explicit mentions of `is_web_public` as False in the stream dict to be
passed to `bulk_create_streams` have been removed.
2018-05-16 13:40:22 -07:00
Shubham Padia
315047a38b
populate_db: Make invite_only default to False.
...
Explicit mentions of `invite_only` as False in the stream dict to be
passed to `bulk_create_streams` have been removed.
2018-05-16 13:40:10 -07:00
Shubham Padia
7b4f6e0058
tests: Make is_announcement_only true for `announce` stream in populate_db.
...
Makes announce stream `is_announcement_only` for the dev db for easier
manual testing. The default value for `is_announcement_only` in
`bulk_create_streams` is False.
2018-05-16 13:35:45 -07:00
Lyla Fischer
98c50f7041
user docs: Update time-format docs.
2018-05-16 16:17:39 -04:00
Tim Abbott
495104bd56
mypy: Clean test_subs.py of mypy strict-optional errors.
...
Most of this is just asserting that the sub_dict return value from
access_stream_by_id is not None in the cases where it shouldn't be,
but additionally, we also need to pass a function into
validate_user_access_to_subscribers_helper (in this case, just `lambda:
True` works fine)
2018-05-16 12:09:52 -07:00
Tim Abbott
ee0f1992bf
lint: Fix lint errors in recently merged tests.
2018-05-15 20:07:33 -07:00
Baron Chandler
1e4f54560a
actions: Ensure validate_user_access_to_subscribers_helper raises on invalid params.
2018-05-15 19:14:43 -07:00
Baron Chandler
024e6fc704
actions: Make sure get_recipient_info asserts on invalid recipient type.
2018-05-15 19:14:42 -07:00
Baron Chandler
7251e978d5
actions: Make sure get_typing_user_profiles raises on invalid recipient types.
2018-05-15 19:14:42 -07:00
Tim Abbott
f0ef335412
models: Remove unused ModelReprMixin class.
...
It appeared to be used as a base class in various Django migrations,
but because it didn't define any model fields, it wasn't actually.
2018-05-15 19:11:22 -07:00
Tim Abbott
351fab204b
str_utils: Move force_bytes into ccache.py.
...
This is only used there, and so belongs in that bundle of
barely-maintained code.
2018-05-15 19:07:32 -07:00
Tim Abbott
aec57baef2
test_presence: Add tests for various analytics pages.
...
While maybe these don't all belong in this test file, the overall
effect is that we now have quite good test coverage on
analytics/views.py.
It'd be nice to add some more assert statements for specific values
being present in the pages, but since we're not really working on that
part of the product, it's not a priority yet.
2018-05-15 18:52:18 -07:00
Tim Abbott
276b78e952
tornado: Extract AsyncDjangoHandlerBase and mark as nocoverage.
...
We're never going to add tests for this block, which is fundamentally
well-tested code from Django with a since line changed which is hard
to screw up (long-polling will not work at all without it). The hope
is to remove it entirely and replace it with a cleaner monkey-patch,
but until then, unit tests for it would be redundant.
2018-05-15 18:39:52 -07:00
Tim Abbott
00861b910d
test_presence: Add tests for seconds_usage_between.
...
This isn't widely used, but is a nice way to verify the logic further.
2018-05-15 18:37:49 -07:00
Tim Abbott
930cbabbb7
test_queue: Add a test for register_json_consumer.
...
This expands the coverage of the SimpleQueueProcessor logic to be
mostly complete. We still don't have real tests for
TornadoQueueProcessor.
2018-05-15 18:24:45 -07:00
Tim Abbott
962c64a1d4
test_queue: Add basic tests for SimpleQueueClient.
2018-05-15 17:56:30 -07:00
Tim Abbott
c46149efcb
migrate: Remove obsolete act_on_message_ranges.
...
This has a cool structure, but it's written against the long-dead
South API, and we can always pull it out of the Git history if we want
to use this approach in the future.
2018-05-15 17:19:14 -07:00
Yashashvi Dave
b949d10592
/json/bots: Replace email with user_id in API to generate bot_api_key.
...
Fixes #3643 .
2018-05-15 16:37:06 -07:00
Yashashvi Dave
d6e2f9fc88
/json/bots: Replace email with user_id in API to update bots.
2018-05-15 16:34:17 -07:00
Tim Abbott
16d807d157
Revert "test_helpers: Fix a nonexistent import."
...
This reverts commit fa18913b8b
.
We fix the typo when doing this, though.
2018-05-15 16:08:29 -07:00
Greg Price
fa18913b8b
test_helpers: Fix a nonexistent import.
...
This module doesn't exist, and never did; the name appears to be a
mistaken variant of the module that really does contain ZulipTestCase.
So, fix the import to use the real name.
This would never have worked at runtime, which is why it's in an
`if False:`. It's also an example of the kind of error that can be
hidden by `ignore_missing_imports`; we'd have caught the issue
immediately if we hadn't had a blanket application of that flag
in place.
2018-05-15 18:14:33 -04:00
Eeshan Garg
f29b9f14fd
integrations: Update docs for git and codebase.
...
Doing both as once due to the common dependency on
change-zulip-config-file-indented.md.
2018-05-15 18:02:56 -04:00
Tim Abbott
31ce382e71
coverage: Disable coverage checking for exceptions.py.
...
We also take the opportunity to slightly improve the errors if
AbstractEnum ever gets used.
2018-05-15 13:57:40 -07:00
Tim Abbott
191e6dc13a
create_user: Remove user_profile_id option.
...
This hasn't been used in years, had no test coverage, and doesn't have
a clear use case.
2018-05-15 13:51:56 -07:00
=
e731aeda44
zerver: Remove dead code from do_change_password.
2018-05-15 13:39:53 -07:00
=
9d07faaf0c
zerver: Remove dead code from do_create_realm.
2018-05-15 13:39:53 -07:00
=
344d6544da
zerver: Remove dead code for accessing subscribers.
...
These haven't been used in years, and clutter the codebase.
2018-05-15 13:39:39 -07:00
Yashashvi Dave
8909836815
zerver/tests/test_custom_profile_data.py: Refactor tests.
...
Refactor custom fields creation and deletion tests to assert
if created/deleted field exist or not, instead of asserting
total count of all realm fields.
2018-05-15 12:38:18 -07:00
Shubham Padia
3703013b4f
models: Add `is_announcement_only` to Stream.to_dict().
2018-05-15 12:05:52 -07:00
Baron Chandler
f59adfa67c
actions: Change do_change_is_admin Exception to an Assertion Error.
...
- do_change_is_admin now raises AssertionError when a non-admin
permission is given.
- adds test to test_users to ensure admin asserts on invalid
permission values.
2018-05-15 11:27:01 -07:00
Baron Chandler
4bdc8332fa
zerver: Require permissions be acceptable to do_change_is_admin.
2018-05-15 11:25:47 -07:00
Yago González
f9f8d9c578
bugdown: Parse argument JSON files as streams.
2018-05-15 11:05:03 -07:00
RobbieClarken
f81b936727
zerver/tests: Require 100% test coverage of zerver/lib/upload.py.
...
The last line here is impossible to test.
Fixes #4489 .
2018-05-15 10:52:20 -07:00
RobbieClarken
17d6d4fed1
zerver/tests: Add test for get_emoji_url for local upload backend.
2018-05-15 10:50:39 -07:00
RobbieClarken
fb42b58316
zerver/tests: Test emoji upload for local storage backend.
2018-05-15 10:50:39 -07:00
RobbieClarken
2dc13d6b50
zerver/tests: Test ensure_medium_avatar_url when the file exists.
2018-05-15 10:50:39 -07:00
RobbieClarken
398141268f
zerver/tests: Test get_emoji_url for S3.
2018-05-15 10:50:39 -07:00
RobbieClarken
dd19ed3972
zerver/tests: Test upload emoji to S3.
2018-05-15 10:50:39 -07:00
RobbieClarken
ff95c67197
zerver/tests: Test upload realm icon for S3.
2018-05-15 10:50:39 -07:00
RobbieClarken
25e91b289d
zerver/tests: Test delete message image from S3 when file is missing.
2018-05-15 10:50:39 -07:00
RobbieClarken
b3a6c0a253
zerver/tests: Test currently_used_upload_space function.
2018-05-15 10:50:38 -07:00
RobbieClarken
efc63d4ca0
zerver/tests: Test S3 file upload with undefined content type.
2018-05-15 10:42:10 -07:00
RobbieClarken
b9fff04f39
zerver/tests: Add test for resize_emoji for images that need resizing.
2018-05-15 10:42:10 -07:00
RobbieClarken
69a5ce102f
zerver/tests: Remove unecessary re-open on files in tests.
...
The get_test_image_file helper function returns a file handle so we can
call the read method on this directly.
2018-05-15 10:42:10 -07:00
RobbieClarken
f34d9dc910
zerver/tests: Test get_realm_for_filename when filename doesn't exist.
2018-05-15 10:42:10 -07:00
Baron Chandler
52d53f4a81
test_subs: Ensure gather_subscriptions_helper excludes deleted streams.
2018-05-15 10:11:32 -07:00
Tim Abbott
a2ed06314d
send_test_email: Throw an error if email not configured.
...
This should help minimize confusion when folks try to use this before
properly configuring outgoing email.
Thanks to Bruce Eckel for the report.
2018-05-14 12:02:36 -07:00
RobbieClarken
2cca5dc79f
zerver/tests: Test upload when mimetype is supplied as a query param.
2018-05-14 10:58:24 -07:00
Joshua Pan
df84e1d7eb
tests: Reach 100% coverage for zerver/liv/management.py.
...
Cleaned up add_user_list_args(). The "help" and
"all_users_help" have all default values. As noted in
an earlier commit, "all_users_help" is always passed in,
so we can get rid of "all_users_arg". We keep the default
for "all_users_help" so we don't have to change variable order
in function definition.
2018-05-14 10:46:21 -07:00
Joshua Pan
ef098d2223
management: Remove the parameter required from add_user_list_args.
...
We remove an unecessary "required" paramter from this function
because as seen in the get_users() function right below, you have
to pass either -u/--users or -a/--all-users, meaning there should
never be a reason to require --users.
2018-05-14 10:46:21 -07:00
Joshua Pan
231b487bca
tests: Cover check_config() in zerver/lib/management.py.
...
Add a comment to code to clarify what the config check does.
2018-05-14 10:46:21 -07:00
Darshan Markandaiah
607cab2a53
tests: Add 100% test coverage to zerver/apps.py.
...
Tweaked by tabbott to rename to test_cache.py and remove the
sender_name argument (Since it was kinda confusing).
2018-05-14 10:36:10 -07:00
Tim Abbott
726017f682
actions: Remove dead do_change_bot_type function.
...
This is a tiny fraction of a feature we don't support, so we should
just kill it.
2018-05-13 17:58:49 -07:00
Tim Abbott
8b09118009
actions: Rename pick_color_helper to pick_color.
...
Now that there's only one function here, it's weird to have the
unnecessary _helper suffix.
2018-05-13 17:52:36 -07:00
Tim Abbott
234b5fa21b
actions: Remove dead pick_color function.
...
We've been using pick_color_helper only for a long time.
2018-05-13 17:52:04 -07:00
Tim Abbott
60cfc210ce
address: Remove dead msg_type function.
...
This was never used; we instead use `.is_stream` and `.is_private`
instead.
2018-05-13 17:47:21 -07:00
Aditya Bansal
bd063b86c4
request.pyi: Remove unused import of typing.Text.
2018-05-14 05:16:22 +05:30
Eeshan Garg
5c0d4660c1
models: Add history_public_to_subscribers to Stream.to_dict().
...
This commit also updates all the relevant parts where this attribute
could be useful, e.g. payloads for user subscriptions.
2018-05-13 09:15:07 -07:00
Shubham Padia
295fcb8536
models: Add `is_announcement_only` to stream_dict in `actions.py`.
...
Adds `is_announcement_only` to `stream_dict`s in order to access
the property in the frontend.
2018-05-13 09:11:51 -07:00
Shubham Padia
897ed17f0c
api: Allow realm_admins to make a stream announcement_only.
2018-05-13 09:11:51 -07:00
Shubham Padia
bb8577ba94
stream: Only realm admins can post to an announcement_only streams.
...
If a non-admin tries to post to an announcement_only stream, error
message will be shown.
2018-05-13 09:11:51 -07:00
Shubham Padia
a5759108d3
models: Add field is_announcement_only to stream.
2018-05-13 09:06:20 -07:00
Vishnu Ks
08d20dce23
docs: Cover the missing case in DocPageTest.
2018-05-13 08:56:04 -07:00
Vishnu Ks
99186952f6
integrations: Make integration_doc endpoint work only on ajax.
2018-05-13 08:56:04 -07:00
Aditya Bansal
a68376e2ba
zerver/lib: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
5416d137d3
zerver/tests: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
993d50f5ab
zerver: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
63dff4549f
zerver/lib/test_classes.py: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
c02011d7f5
zerver/lib/bugdown/__init__.py: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
97b7075dd2
zerver/lib/actions.py: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
e9f87671e2
zerver/models.py: Change use of typing.Text to str.
2018-05-12 15:22:38 -07:00
Aditya Bansal
e79a2f2707
zerver/tornado: Change use of typing.Text to str.
2018-05-12 15:22:38 -07:00
Aditya Bansal
a40ae4cae5
zerver/webhooks: Change use of typing.Text to str.
2018-05-12 15:21:24 -07:00
Aditya Bansal
64ddfc6ac0
zerver/webhooks: Change use of typing.Text to str.
2018-05-10 14:19:49 -07:00
Aditya Bansal
e8506b5020
zerver/management: Change use of typing.Text to str.
2018-05-10 14:19:49 -07:00