Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

devtools: Remove development-only user creation management commands.

Tim Abbott2328a81f55a2
diff --git a/templates/zerver/development/dev_tools.html b/templates/zerver/development/dev_tools.html
index 8d5fbeb6df5..b4a77a594cb 100644
--- a/templates/zerver/development/dev_tools.html
+++ b/templates/zerver/development/dev_tools.html
@@ -85,8 +85,8 @@
<ul>
<li><code>./manage.py populate_db</code>: Rebuilds database. Has options to e.g. create 3K users for testing.</li>
<li><code>./manage.py mark_all_messages_unread</code>: Useful for testing reading messages.</li>
- <li><code>./manage.py add_new_realm</code>: Add a new realm. Useful for testing onboarding.</li>
- <li><code>./manage.py add_new_user</code>: Add a new user. Useful for testing onboarding.</li>
+ <li><code>./manage.py create_realm</code>: Add a new realm. Useful for testing onboarding.</li>
+ <li><code>./manage.py create_user</code>: Add a new user. Useful for testing onboarding.</li>
<li><code>./manage.py add_mock_conversation</code>: Add test messages, streams, images, emoji, etc.
into the dev environment. First edit zilencer/management/commands/add_mock_conversation.py
to add the data you're testing.
diff --git a/zilencer/management/commands/add_new_realm.py b/zilencer/management/commands/add_new_realm.py
deleted file mode 100644
index 170939a5dfb..00000000000
--- a/zilencer/management/commands/add_new_realm.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from typing import Any
-
-from zerver.lib.actions import do_create_realm, do_create_user
-from zerver.lib.management import ZulipBaseCommand
-from zerver.models import Realm, UserProfile
-
-
-class Command(ZulipBaseCommand):
- help = """Add a new realm and initial user for manual testing of the onboarding process."""
-
- def handle(self, *args: Any, **options: Any) -> None:
- string_id = "realm{:02}".format(Realm.objects.filter(string_id__startswith="realm").count())
- realm = do_create_realm(string_id, string_id)
-
- name = "{:02}-user".format(UserProfile.objects.filter(email__contains="user@").count())
- do_create_user(
- f"{name}@{string_id}.zulip.com",
- "password",
- realm,
- name,
- role=UserProfile.ROLE_REALM_ADMINISTRATOR,
- realm_creation=True,
- acting_user=None,
- )
diff --git a/zilencer/management/commands/add_new_user.py b/zilencer/management/commands/add_new_user.py
deleted file mode 100644
index ca702c2c7b5..00000000000
--- a/zilencer/management/commands/add_new_user.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from typing import Any
-
-from django.core.management.base import CommandParser
-
-from zerver.lib.actions import do_create_user
-from zerver.lib.management import ZulipBaseCommand
-from zerver.models import Realm, UserProfile
-
-
-class Command(ZulipBaseCommand):
- help = """Add a new user for manual testing of the onboarding process.
-If realm is unspecified, will try to use a realm created by add_new_realm,
-and will otherwise fall back to the zulip realm."""
-
- def add_arguments(self, parser: CommandParser) -> None:
- self.add_realm_args(parser)
-
- def handle(self, *args: Any, **options: Any) -> None:
- realm = self.get_realm(options)
- if realm is None:
- realm = (
- Realm.objects.filter(string_id__startswith="realm").order_by("-string_id").first()
- )
- if realm is None:
- print(
- "Warning: Using default zulip realm, which has an unusual configuration.\n"
- "Try running `manage.py add_new_realm`, and then running this again."
- )
- valid_realm = Realm.objects.get(string_id="zulip")
- domain = "zulip.com"
- else:
- valid_realm = realm
- domain = realm.string_id + ".zulip.com"
-
- name = "{:02}-user".format(UserProfile.objects.filter(email__contains="user@").count())
- do_create_user(f"{name}@{domain}", "password", valid_realm, name, acting_user=None)