Commit Graph

1566 Commits

Author SHA1 Message Date
Tim Abbott
1549f8773e portico: Always display org info when a server has only 1 realm.
Previously, we were incorrectly using the get_unique_open_realm
function to determine whether we're in the (common) single-realm
server case and should just display an org-info-enabled login form on
the homepage.

Now, we use a slightly different function extracted from
get_unique_open_realm that doesn't check whether the realm is
invite-only.

Fixes #4841.
2017-06-02 15:00:22 -07:00
Tim Abbott
1f48fa2767 invite: Fix invite_by_admins_only to be enforced in backend.
This is CVE-2017-0896.

Apparently, this setting never actually was wired up to anything other
than hiding the UI widget.

Huge thanks to Ibram Marzouk from the HackerOne community for finding
this security bug.
2017-06-01 17:24:29 -07:00
Tim Abbott
73f8653da6 test_messages: Increase time allowed for bulk send.
This fixes an occasional test flake we've been seeing recently.
2017-06-01 00:00:36 -07:00
Aditya Bansal
a0faf3364a pep8: Add compliance with rule E261 test_reactions.py. 2017-05-31 17:07:15 -07:00
Aditya Bansal
7bb669ccb4 pep8: Add compliance with rule E261 test_email_mirror.py. 2017-05-31 17:07:15 -07:00
Umair Khan
5d794d08dd test_bulk_message_fetching: Add debug code.
This test fails on self.assertTrue(delay < 0.001 * num_ids, error_msg)
randomly. This commit adds debug code to see what the real values of
paramters are.
2017-05-31 09:27:30 -07:00
Umair Khan
71f97b7bcb testing: Invalidate cache before counting queries.
To get accurate count of the queries, we should make sure that
caches don't come into play. If we count queries while caches are
filled, we will get a lower count. Caches are not supposed to be
persistent, so our test can also fail if cache is invalidated
during the course of the unit test.

This commit solves the problem with Stream cache. This cache comes
into play when we use `get_stream` function. If cache is valid,
we will not issue queries to Stream and Recipient table. I think
the problem was one of those rare occasions when the Stream cache
got invalidated during the course of the test, due to which query
count was increased by 2. After this commit, we intentially invalidate
the Stream cache.
2017-05-30 17:28:41 +05:00
K.Kanakhin
2434f2d96c messages: Add support for admins deleting messages.
This makes it possible for Zulip administrators to delete messages.
This is primarily intended for use in deleting early test messages,
but it can solve other problems as well.

Later we'll want to play with the permissions model for this, but for
now, the goal is just to integrate the feature.

Note that it saves the deleted messages for some time using the same
approach as Zulip's message retention policy feature.

Fixes #135.
2017-05-29 21:59:38 -07:00
Harshit Bansal
298e23b447 realm_emoji.py: Allow an user to delete an emoji uploaded by them.
If a realm is configured to allow any user to upload an emoji,
then, an emoji author must be allowed to delete an emoji uploaded
by them.
2017-05-29 20:21:25 -07:00
vaibhav
9cf9837f12 webhooks: Add outgoing webhook bot user to development database. 2017-05-29 16:01:23 -07:00
Tim Abbott
4893779001 test_events: Avoid coverage errors in LogEventsTest. 2017-05-29 15:26:33 -07:00
Maxim Averin
a4c3f571db Switch change_tos_version to use RealmAuditLog. 2017-05-29 15:24:01 -07:00
Maxim Averin
685fb16c39 Switch change_full_name to use RealmAuditLog.
This requires adding an `acting_user` parameter to the
`do_change_bot_owner` function.
2017-05-29 15:22:08 -07:00
Steve Howell
1f4e1ece3a Fix flaky time-based test.
For testing waiting period thresholds, we need to
explicitly set date_joined for Hamlet to be now.
2017-05-29 11:54:06 -06:00
Ron Shafii
8cc1f13d24 test: Add test_notify_realm_of_new_user. 2017-05-28 19:14:52 -07:00
Ethan Estrada
91e6f00d57 Test that log_event auto creates missing log dir. 2017-05-28 18:24:00 -07:00
Ethan Estrada
a11c578d57 Test for early return when "LOG_EVENT_DIR" is None. 2017-05-28 18:21:50 -07:00
Reid Barton
ccb4c5c26f bots: Move zephyr-related files to api/integrations/zephyr/. 2017-05-26 15:07:02 -07:00
Tim Abbott
f5373c46f2 lint: Fix trailing newlines in outgoing webhook tests. 2017-05-25 16:28:11 -07:00
Elliott Jin
4907f24603 bots: Add additional service bot tests. 2017-05-25 15:00:51 -07:00
Elliott Jin
af49a23013 bots: Generalize service bot tests to also test embedded bots. 2017-05-25 15:00:51 -07:00
Elliott Jin
cd8c77bf91 bots: Clean up order and naming of service bot tests. 2017-05-25 15:00:51 -07:00
Elliott Jin
49adeee8c8 bots: Move service bot tests into separate file. 2017-05-25 15:00:51 -07:00
Vishnu Ks
bb98e35aa0 Replace othello@zulip.com with example_email('othello'). 2017-05-24 19:37:36 -07:00
Vishnu Ks
52d2d6c4fa Replace prospero@zulip.com with example_email('prospero'). 2017-05-24 19:37:36 -07:00
Vishnu Ks
c4db3b7d1c Replace cordelia@zulip.com with example_email('cordelia'). 2017-05-24 19:37:36 -07:00
Vishnu Ks
961b35d52e Replace iago@zulip.com with example_email('iago'). 2017-05-24 19:37:36 -07:00
Vishnu Ks
5230eaef1c Replace hamlet@zulip.com with example_email('hamlet'). 2017-05-24 19:37:36 -07:00
Vishnu Ks
b65f692fcf Make LoginEmailValidatorTestCase use ZulipTestCase instead of TestCase. 2017-05-24 19:23:48 -07:00
Tim Abbott
6aaca44e17 tests: Fix str/Text mypy issues in various tests. 2017-05-24 15:19:38 -07:00
Andrew Archer
6c3f89af1c tests: Remove get_user_profile_by_email from numerous tests. 2017-05-24 15:19:20 -07:00
Rick Chern
e53d1c3885 tests: Remove get_user_profile_by_email from most tests. 2017-05-24 13:05:19 -07:00
Vishnu Ks
4403d179df tests: Replace mit_user().email with mit_email(). 2017-05-24 12:44:43 -07:00
Tim Abbott
e5f5e5c69f tests: Remove unnecessary maxDiff settings.
Now that ZulipTestCase does this, we don't need it in all these
individual test modules.
2017-05-24 12:43:28 -07:00
umkay
ccc70445d6 mypy: Fix strict-optional errors for test files.
Fix mypy --strict-optional errors in zerver/tests
2017-05-24 12:43:28 -07:00
Tim Abbott
17328a7557 tests: Fix incorrect use of get_realm_by_email_domain. 2017-05-24 12:43:28 -07:00
Tim Abbott
895d4a795b mypy: Fix a missing type annotation. 2017-05-24 12:14:13 -07:00
Umair Khan
9a04fef71b testing: Reset active language.
After running translation tests, we should reset the active
language to isolate the change
2017-05-24 11:35:17 -07:00
Umair Khan
ebb9bd1a6a testing: Avoid class variables to enforce isolation.
Class variables are shared between all instances and as a result
changes made by one instance are leaked to other instances.
2017-05-24 11:35:12 -07:00
Yago González
c0f2036435 api: Handle unregistered users in dev_fetch_api_key.
Fixes #4851.
2017-05-24 09:39:44 -07:00
Andrew Archer
67cf4c4fb4 test_alert_words: Remove use of get_user_profile_by_email. 2017-05-23 22:14:10 -07:00
kb0rg
eb2d0ebd09 Add test for do_deactivate_realm exit if deactivated.
Rename existing test_do_deactivate_realm to indicate test purpose
is to confirm user realm cache clears when a realm is deactivated.
2017-05-23 21:38:07 -07:00
kb0rg
e672ec62c1 Add test for encode_email_address with empty Gateway. 2017-05-23 21:38:07 -07:00
kb0rg
d625cca2f8 minor: Rename test class -> TestEmptyGatewaySetting. 2017-05-23 21:38:07 -07:00
vaibhav
f94c321567 Outgoing Webhook System: Add support for personal message triggers. 2017-05-23 21:35:09 -07:00
Lech Kaiel
6b49e667ef tests: Replaced @zulip.com references with self.example_ functions.
This cleans up the excessive use of @zulip.com emails in the tests.
2017-05-23 20:59:50 -07:00
ron-s
e5d4e0f0eb Test: Add test_notify_of_new_user_internally. 2017-05-23 20:27:37 -07:00
Steve Howell
036f66aba3 Add test_get_avatar_url_with_user_profile_lookup test. 2017-05-23 18:35:45 -07:00
Vishnu Ks
b5c4a95ef1 test_bots.py: Use example_email instead of using the emails directly. 2017-05-23 18:31:43 -07:00
Vishnu Ks
dbdc0220b9 test_presence.py: Remove unused get_user_profile_by_email import. 2017-05-23 18:31:43 -07:00