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
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
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
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
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
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
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
5416d137d3
zerver/tests: Change use of typing.Text to str.
2018-05-12 15:22:39 -07:00
Aditya Bansal
2f3b2fbf59
zerver/tests: Change use of typing.Text to str.
2018-05-10 14:19:49 -07:00
Tim Abbott
81e17c7d47
test_i18n: Stop using six.moves for SimpleCookie.
...
This requires a 'type: ignore' because of a typeshed bug.
2018-05-09 20:45:45 -07:00
Tim Abbott
4c1777f146
tests: Add a good set of unit tests for UserActivityInterval.
...
This system was written years ago and has been working well the whole
time, but having unit tests for it will help future developers in
understanding what the intent is.
2018-05-09 20:45:02 -07:00
Tim Abbott
fba45bb9d3
archive: Add functions for accessing web-public streams.
...
These will be helpful for variable upcoming projects to support the
web-public streams feature.
2018-05-08 12:12:15 -07:00
Tim Abbott
f24630fd4a
events: Include data for whether push notifications are enabled.
...
This is primarily useful for the mobile app, but could also be used to
control whether we display push-notifications related settings to
users in the web UI.
2018-05-08 11:45:13 -07:00
Eeshan Garg
34d1b0ebf1
webhooks: Add helper to extract and validate HTTP event headers.
...
This is a part of our efforts to close #6213 .
2018-05-05 15:48:37 -07:00
Tim Abbott
956bd74905
attachments: Send events for attachment updates.
...
We send add events on upload, update events when sending a message
referencing it, and delete updates on removal.
This should make it possible to do real-time sync for the attachments
UI.
Based in part on work by Aastha Gupta.
2018-05-04 16:22:27 -07:00
Tim Abbott
69c4645bd2
attachments: Stop fetching attachments in / endpoint.
...
We only use this data in a rarely-used settings screen, and it can be
large after years of posting screenshots.
So optimize the performance of / by just loading these data when we
actually visit the page.
This saves about 300ms of runtime for loading the home view for my
user account on chat.zulip.org.
2018-05-04 16:22:26 -07:00
Tim Abbott
59d3fefc07
bots: Improve performance of fetching core bot data.
...
This eliminates the need to call user_ids_to_users inside the
get_service_dicts_for_bots code path, saving a database query.
This completes my refactor to fix backend performance issues in this
code path. Previously, our messy layering of queries that resulted in
Zulip doing work even if none of the bots actually had Services or
config_data.
2018-05-04 13:44:43 -07:00
Vishnu Ks
733da0ac07
settings: Fix 500 when trying to change email to disposable email.
...
Fixes #9240
2018-05-04 10:52:38 -07:00
Tim Abbott
508dc5b6ed
decorators: Add new decorators for guest users.
...
These decorators will be part of the process for disabling access to
various features for guest users.
Adding this decorator to the subscribe endpoint breaks the guest users
test we'd just added for the subscribe code path; we address this by
adding a more base-level test on filter_stream_authorization.
2018-05-04 10:25:52 -07:00
Tim Abbott
8b26f912af
streams: Limit access to public streams for guest users.
...
With most of the tests tests written by Shubham Dhama.
2018-05-04 09:47:58 -07:00
Tim Abbott
7cbff8b521
push registration: Use standard error message for auth problems.
...
This avoids adding an unnecessary new translated string.
2018-05-04 09:04:39 -07:00
Tim Abbott
43098a6f7c
zilencer: Add automated signup system for push notifications.
...
Based on an initial version by Rishi Gupta.
Fixes #7325 .
2018-05-03 21:27:49 -07:00
Tim Abbott
51517fa188
request: Add new str_validator validator type.
...
This is helpful for cases where an argument is supposed to be a normal
string, and we want to use a Zulip validator function to do basic
things like check its length.
2018-05-03 21:11:02 -07:00
Tim Abbott
f2e84f25a0
management: Refactor checkconfig code to live in library.
...
This makes it possible to call this from other management commands.
2018-05-03 21:11:02 -07:00
Tim Abbott
ad0cfb3512
validators: Add check_string_fixed_length.
...
This will be useful in some upcoming work on zilencer.
2018-05-03 14:30:03 -07:00
Tim Abbott
594451707d
check_capped_string: Clean up corner case.
...
We were rejecting strings of length equal to the max.
While we're at it, fix the unnecessary period in the error message,
which doesn't align with similar validators.
2018-05-03 14:30:03 -07:00