zulip/zerver
sahil839 683b6f7d65 tests: Refactor test_can_create_streams and test_can_subscribe_other_users.
We refactor test_can_create_streams and test_can_subscribe_other_users
in test_subs.py. We want to follow a specific order in such tests
which is just set the policy value one by one and then checking
that the role in policy returns true and role just below that returns
false. This approach is explained in detail below.

Following hierarchy of roles is considered for these tests -
1. Realm admin
2. Full members
3. Members
4. Guests.

Then if the policy is set to admins only, we check that the having
role as admin returns true and the role just below that, i.e. full
member returns false. Similarly, if the policy is set to members
only, we check that a member should return true and role below it
which is guest should return false. We basically follow these as
we can assume that if a user with particular role cannot do the
required task, then user with role below in the hierarchy would
be not allowed to do the task too.

This commit refactors the above mentioned two tests to have above
explained workflow.
2021-03-24 12:33:58 -07:00
..
data_import import/export: Fix deprecated authentication method for Slack. 2021-03-08 12:56:37 -08:00
lib event_schema: Add checker for restart event. 2021-03-23 12:16:20 -07:00
management python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
migrations display_settings: Allow user to set default_view. 2021-03-11 18:09:08 -08:00
openapi event_schema: Add schema check for realm/deactivated event. 2021-03-23 12:16:16 -07:00
templatetags python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
tests tests: Refactor test_can_create_streams and test_can_subscribe_other_users. 2021-03-24 12:33:58 -07:00
tornado docs: Add a document explaining email/push notifications. 2021-03-05 15:24:25 -08:00
views api: Support user_id in get_user_presence_endpoint. 2021-03-11 20:14:04 -08:00
webhooks sentry: Do not assume context lines exist in stacktrace. 2021-03-22 12:16:10 -07:00
worker invites: Delete old compat code in the invites queue worker. 2021-02-26 08:26:43 -08:00
__init__.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
apps.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
context_processors.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
decorator.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
filters.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
forms.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
logging_handlers.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
middleware.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
models.py models: Make get_human_admin_users optionally not return realm owners. 2021-03-22 18:10:03 -07:00
signals.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00