mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
users: Add new user 'shiva' as realm moderator.
Note that at this point, it's not possible to create moderator users; this just will make it easier to write tests for logic involving them as we develop the feature.
This commit is contained in:
@@ -173,9 +173,9 @@ async function create_stream(page: Page): Promise<void> {
|
|||||||
assert.strictEqual(stream_name, "Puppeteer");
|
assert.strictEqual(stream_name, "Puppeteer");
|
||||||
assert.strictEqual(stream_description, "Everything Puppeteer");
|
assert.strictEqual(stream_description, "Everything Puppeteer");
|
||||||
|
|
||||||
// Assert subscriber count becomes 5(scotland(+4), cordelia(+1), othello(-1), Desdemona(+1)).
|
// Assert subscriber count becomes 6(scotland(+5), cordelia(+1), othello(-1), Desdemona(+1)).
|
||||||
await page.waitForFunction(
|
await page.waitForFunction(
|
||||||
(subscriber_count_selector: string) => $(subscriber_count_selector).text().trim() === "5",
|
(subscriber_count_selector: string) => $(subscriber_count_selector).text().trim() === "6",
|
||||||
{},
|
{},
|
||||||
subscriber_count_selector,
|
subscriber_count_selector,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -379,6 +379,7 @@ Output:
|
|||||||
ZOE="ZOE@zulip.com",
|
ZOE="ZOE@zulip.com",
|
||||||
polonius="polonius@zulip.com",
|
polonius="polonius@zulip.com",
|
||||||
desdemona="desdemona@zulip.com",
|
desdemona="desdemona@zulip.com",
|
||||||
|
shiva="shiva@zulip.com",
|
||||||
webhook_bot="webhook-bot@zulip.com",
|
webhook_bot="webhook-bot@zulip.com",
|
||||||
welcome_bot="welcome-bot@zulip.com",
|
welcome_bot="welcome-bot@zulip.com",
|
||||||
outgoing_webhook_bot="outgoing-webhook@zulip.com",
|
outgoing_webhook_bot="outgoing-webhook@zulip.com",
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ def add_subscriptions(client: Client) -> None:
|
|||||||
# {code_example|start}
|
# {code_example|start}
|
||||||
# To subscribe other users to a stream, you may pass
|
# To subscribe other users to a stream, you may pass
|
||||||
# the `principals` argument, like so:
|
# the `principals` argument, like so:
|
||||||
user_id = 25
|
user_id = 26
|
||||||
result = client.add_subscriptions(
|
result = client.add_subscriptions(
|
||||||
streams=[
|
streams=[
|
||||||
{"name": "new stream", "description": "New stream for testing"},
|
{"name": "new stream", "description": "New stream for testing"},
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ class ImportExportTest(ZulipTestCase):
|
|||||||
|
|
||||||
# We set up 4 alert words for Hamlet, Cordelia, etc.
|
# We set up 4 alert words for Hamlet, Cordelia, etc.
|
||||||
# when we populate the test database.
|
# when we populate the test database.
|
||||||
num_zulip_users = 9
|
num_zulip_users = 10
|
||||||
self.assertEqual(len(exported_alert_words), num_zulip_users * 4)
|
self.assertEqual(len(exported_alert_words), num_zulip_users * 4)
|
||||||
|
|
||||||
self.assertIn("robotics", {r["word"] for r in exported_alert_words})
|
self.assertIn("robotics", {r["word"] for r in exported_alert_words})
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ class TestExport(ZulipTestCase):
|
|||||||
call("\033[94mExporting realm\033[0m: zulip"),
|
call("\033[94mExporting realm\033[0m: zulip"),
|
||||||
call("\n\033[94mMessage content:\033[0m\nOutbox emoji for export\n"),
|
call("\n\033[94mMessage content:\033[0m\nOutbox emoji for export\n"),
|
||||||
call(
|
call(
|
||||||
"\033[94mNumber of users that reacted outbox:\033[0m 2 / 8 total non-guest users\n"
|
"\033[94mNumber of users that reacted outbox:\033[0m 2 / 9 total non-guest users\n"
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ class UserSoftDeactivationTests(ZulipTestCase):
|
|||||||
self.example_user("aaron"),
|
self.example_user("aaron"),
|
||||||
self.example_user("polonius"),
|
self.example_user("polonius"),
|
||||||
self.example_user("desdemona"),
|
self.example_user("desdemona"),
|
||||||
|
self.example_user("shiva"),
|
||||||
]
|
]
|
||||||
client, _ = Client.objects.get_or_create(name="website")
|
client, _ = Client.objects.get_or_create(name="website")
|
||||||
query = "/some/random/endpoint"
|
query = "/some/random/endpoint"
|
||||||
@@ -104,7 +105,7 @@ class UserSoftDeactivationTests(ZulipTestCase):
|
|||||||
filter_kwargs = dict(user_profile__realm=get_realm("zulip"))
|
filter_kwargs = dict(user_profile__realm=get_realm("zulip"))
|
||||||
users_to_deactivate = get_users_for_soft_deactivation(-1, filter_kwargs)
|
users_to_deactivate = get_users_for_soft_deactivation(-1, filter_kwargs)
|
||||||
|
|
||||||
self.assert_length(users_to_deactivate, 9)
|
self.assert_length(users_to_deactivate, 10)
|
||||||
for user in users_to_deactivate:
|
for user in users_to_deactivate:
|
||||||
self.assertTrue(user in users)
|
self.assertTrue(user in users)
|
||||||
|
|
||||||
@@ -155,6 +156,7 @@ class UserSoftDeactivationTests(ZulipTestCase):
|
|||||||
self.example_user("aaron"),
|
self.example_user("aaron"),
|
||||||
self.example_user("polonius"),
|
self.example_user("polonius"),
|
||||||
self.example_user("desdemona"),
|
self.example_user("desdemona"),
|
||||||
|
self.example_user("shiva"),
|
||||||
]
|
]
|
||||||
for user_profile in UserProfile.objects.all():
|
for user_profile in UserProfile.objects.all():
|
||||||
user_profile.long_term_idle = True
|
user_profile.long_term_idle = True
|
||||||
@@ -163,7 +165,7 @@ class UserSoftDeactivationTests(ZulipTestCase):
|
|||||||
filter_kwargs = dict(realm=get_realm("zulip"))
|
filter_kwargs = dict(realm=get_realm("zulip"))
|
||||||
users_to_catch_up = get_soft_deactivated_users_for_catch_up(filter_kwargs)
|
users_to_catch_up = get_soft_deactivated_users_for_catch_up(filter_kwargs)
|
||||||
|
|
||||||
self.assert_length(users_to_catch_up, 9)
|
self.assert_length(users_to_catch_up, 10)
|
||||||
for user in users_to_catch_up:
|
for user in users_to_catch_up:
|
||||||
self.assertTrue(user in users)
|
self.assertTrue(user in users)
|
||||||
|
|
||||||
|
|||||||
@@ -3410,7 +3410,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertNotIn(self.example_user("polonius").id, add_peer_event["users"])
|
self.assertNotIn(self.example_user("polonius").id, add_peer_event["users"])
|
||||||
self.assertEqual(len(add_peer_event["users"]), 11)
|
self.assertEqual(len(add_peer_event["users"]), 12)
|
||||||
self.assertEqual(add_peer_event["event"]["type"], "subscription")
|
self.assertEqual(add_peer_event["event"]["type"], "subscription")
|
||||||
self.assertEqual(add_peer_event["event"]["op"], "peer_add")
|
self.assertEqual(add_peer_event["event"]["op"], "peer_add")
|
||||||
self.assertEqual(add_peer_event["event"]["user_ids"], [self.user_profile.id])
|
self.assertEqual(add_peer_event["event"]["user_ids"], [self.user_profile.id])
|
||||||
@@ -3442,7 +3442,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||||||
# We don't send a peer_add event to othello
|
# We don't send a peer_add event to othello
|
||||||
self.assertNotIn(user_profile.id, add_peer_event["users"])
|
self.assertNotIn(user_profile.id, add_peer_event["users"])
|
||||||
self.assertNotIn(self.example_user("polonius").id, add_peer_event["users"])
|
self.assertNotIn(self.example_user("polonius").id, add_peer_event["users"])
|
||||||
self.assertEqual(len(add_peer_event["users"]), 11)
|
self.assertEqual(len(add_peer_event["users"]), 12)
|
||||||
self.assertEqual(add_peer_event["event"]["type"], "subscription")
|
self.assertEqual(add_peer_event["event"]["type"], "subscription")
|
||||||
self.assertEqual(add_peer_event["event"]["op"], "peer_add")
|
self.assertEqual(add_peer_event["event"]["op"], "peer_add")
|
||||||
self.assertEqual(add_peer_event["event"]["user_ids"], [user_profile.id])
|
self.assertEqual(add_peer_event["event"]["user_ids"], [user_profile.id])
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ class Command(BaseCommand):
|
|||||||
("aaron", "AARON@zulip.com"),
|
("aaron", "AARON@zulip.com"),
|
||||||
("Polonius", "polonius@zulip.com"),
|
("Polonius", "polonius@zulip.com"),
|
||||||
("Desdemona", "desdemona@zulip.com"),
|
("Desdemona", "desdemona@zulip.com"),
|
||||||
|
("शिव", "shiva@zulip.com"),
|
||||||
]
|
]
|
||||||
|
|
||||||
# For testing really large batches:
|
# For testing really large batches:
|
||||||
@@ -444,6 +445,9 @@ class Command(BaseCommand):
|
|||||||
desdemona = get_user_by_delivery_email("desdemona@zulip.com", zulip_realm)
|
desdemona = get_user_by_delivery_email("desdemona@zulip.com", zulip_realm)
|
||||||
do_change_user_role(desdemona, UserProfile.ROLE_REALM_OWNER, acting_user=None)
|
do_change_user_role(desdemona, UserProfile.ROLE_REALM_OWNER, acting_user=None)
|
||||||
|
|
||||||
|
shiva = get_user_by_delivery_email("shiva@zulip.com", zulip_realm)
|
||||||
|
do_change_user_role(shiva, UserProfile.ROLE_MODERATOR, acting_user=None)
|
||||||
|
|
||||||
guest_user = get_user_by_delivery_email("polonius@zulip.com", zulip_realm)
|
guest_user = get_user_by_delivery_email("polonius@zulip.com", zulip_realm)
|
||||||
guest_user.role = UserProfile.ROLE_GUEST
|
guest_user.role = UserProfile.ROLE_GUEST
|
||||||
guest_user.save(update_fields=["role"])
|
guest_user.save(update_fields=["role"])
|
||||||
@@ -533,6 +537,7 @@ class Command(BaseCommand):
|
|||||||
"ZOE@zulip.com": ["Verona", "Denmark", "Scotland", "Venice", "Rome"],
|
"ZOE@zulip.com": ["Verona", "Denmark", "Scotland", "Venice", "Rome"],
|
||||||
"polonius@zulip.com": ["Verona"],
|
"polonius@zulip.com": ["Verona"],
|
||||||
"desdemona@zulip.com": ["Verona", "Denmark", "Venice"],
|
"desdemona@zulip.com": ["Verona", "Denmark", "Venice"],
|
||||||
|
"shiva@zulip.com": ["Verona", "Denmark", "Scotland"],
|
||||||
}
|
}
|
||||||
|
|
||||||
for profile in profiles:
|
for profile in profiles:
|
||||||
|
|||||||
Reference in New Issue
Block a user