mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
test_classes: Add submit_realm_creation_form helper.
This commit adds a new helper submit_realm_creation_form, similar to existing submit_reg_form_for_user, to avoid duplicate code for creating realms in tests.
This commit is contained in:
@@ -302,14 +302,8 @@ class TestSupportEndpoint(ZulipTestCase):
|
|||||||
check_zulip_realm_query_result(result)
|
check_zulip_realm_query_result(result)
|
||||||
|
|
||||||
email = self.nonreg_email("alice")
|
email = self.nonreg_email("alice")
|
||||||
self.client_post(
|
self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
result = get_check_query_result(email, 1)
|
result = get_check_query_result(email, 1)
|
||||||
check_realm_creation_query_result(result, email)
|
check_realm_creation_query_result(result, email)
|
||||||
|
|||||||
@@ -802,6 +802,28 @@ Output:
|
|||||||
**extra,
|
**extra,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def submit_realm_creation_form(
|
||||||
|
self,
|
||||||
|
email: str,
|
||||||
|
*,
|
||||||
|
realm_subdomain: str,
|
||||||
|
realm_name: str,
|
||||||
|
realm_type: int = Realm.ORG_TYPES["business"]["id"],
|
||||||
|
realm_in_root_domain: Optional[str] = None,
|
||||||
|
) -> "TestHttpResponse":
|
||||||
|
payload = {
|
||||||
|
"email": email,
|
||||||
|
"realm_name": realm_name,
|
||||||
|
"realm_type": realm_type,
|
||||||
|
"realm_subdomain": realm_subdomain,
|
||||||
|
}
|
||||||
|
if realm_in_root_domain is not None:
|
||||||
|
payload["realm_in_root_domain"] = realm_in_root_domain
|
||||||
|
return self.client_post(
|
||||||
|
"/new/",
|
||||||
|
payload,
|
||||||
|
)
|
||||||
|
|
||||||
def get_confirmation_url_from_outbox(
|
def get_confirmation_url_from_outbox(
|
||||||
self,
|
self,
|
||||||
email_address: str,
|
email_address: str,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from zerver.lib.rate_limiter import (
|
|||||||
)
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.zephyr import compute_mit_user_fullname
|
from zerver.lib.zephyr import compute_mit_user_fullname
|
||||||
from zerver.models import PushDeviceToken, Realm, UserProfile
|
from zerver.models import PushDeviceToken, UserProfile
|
||||||
|
|
||||||
if settings.ZILENCER_ENABLED:
|
if settings.ZILENCER_ENABLED:
|
||||||
from zilencer.models import RateLimitedRemoteZulipServer, RemoteZulipServer
|
from zilencer.models import RateLimitedRemoteZulipServer, RemoteZulipServer
|
||||||
@@ -223,14 +223,8 @@ class RateLimitTests(ZulipTestCase):
|
|||||||
def test_create_realm_rate_limiting(self) -> None:
|
def test_create_realm_rate_limiting(self) -> None:
|
||||||
with self.settings(OPEN_REALM_CREATION=True):
|
with self.settings(OPEN_REALM_CREATION=True):
|
||||||
self.do_test_hit_ratelimits(
|
self.do_test_hit_ratelimits(
|
||||||
lambda: self.client_post(
|
lambda: self.submit_realm_creation_form(
|
||||||
"/new/",
|
email="new@zulip.com", realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": "new@zulip.com",
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
is_json=False,
|
is_json=False,
|
||||||
)
|
)
|
||||||
@@ -296,14 +290,8 @@ class RateLimitTests(ZulipTestCase):
|
|||||||
nonlocal request_count
|
nonlocal request_count
|
||||||
request_count += 1
|
request_count += 1
|
||||||
if request_count % 2 == 1:
|
if request_count % 2 == 1:
|
||||||
return self.client_post(
|
return self.submit_realm_creation_form(
|
||||||
"/new/",
|
email="new@zulip.com", realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": "new@zulip.com",
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return self.client_post("/accounts/find/", {"emails": "new@zulip.com"})
|
return self.client_post("/accounts/find/", {"emails": "new@zulip.com"})
|
||||||
|
|||||||
@@ -1259,15 +1259,10 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
get_realm(string_id)
|
get_realm(string_id)
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=org_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": org_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
result["Location"].endswith(
|
result["Location"].endswith(
|
||||||
@@ -1367,14 +1362,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_create_realm_as_system_bot(self) -> None:
|
def test_create_realm_as_system_bot(self) -> None:
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email="notification-bot@zulip.com", realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": "notification-bot@zulip.com",
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assert_in_response("notification-bot@zulip.com is reserved for system bots", result)
|
self.assert_in_response("notification-bot@zulip.com is reserved for system bots", result)
|
||||||
@@ -1388,14 +1377,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
|
|
||||||
with self.settings(OPEN_REALM_CREATION=False):
|
with self.settings(OPEN_REALM_CREATION=False):
|
||||||
# Create new realm with the email, but no creation key.
|
# Create new realm with the email, but no creation key.
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assert_in_response("Organization creation link required", result)
|
self.assert_in_response("Organization creation link required", result)
|
||||||
@@ -1412,14 +1395,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
get_realm(string_id)
|
get_realm(string_id)
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1464,14 +1441,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
get_realm(string_id)
|
get_realm(string_id)
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1519,14 +1490,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
get_realm(string_id)
|
get_realm(string_id)
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1585,14 +1550,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
get_realm(string_id)
|
get_realm(string_id)
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1636,14 +1595,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
realm_name = "Test"
|
realm_name = "Test"
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1683,14 +1636,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
realm_name = "Test"
|
realm_name = "Test"
|
||||||
|
|
||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1733,15 +1680,10 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
with self.assertRaises(Realm.DoesNotExist):
|
with self.assertRaises(Realm.DoesNotExist):
|
||||||
get_realm(string_id)
|
get_realm(string_id)
|
||||||
|
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
result["Location"].endswith(
|
result["Location"].endswith(
|
||||||
@@ -1793,14 +1735,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
get_realm(second_string_id)
|
get_realm(second_string_id)
|
||||||
|
|
||||||
# Now we pre-generate two realm creation links
|
# Now we pre-generate two realm creation links
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=first_string_id, realm_name=first_realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": first_realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": first_string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1813,15 +1749,8 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
first_confirmation_url = self.get_confirmation_url_from_outbox(email)
|
first_confirmation_url = self.get_confirmation_url_from_outbox(email)
|
||||||
self.assertEqual(PreregistrationRealm.objects.filter(email=email, status=0).count(), 1)
|
self.assertEqual(PreregistrationRealm.objects.filter(email=email, status=0).count(), 1)
|
||||||
|
|
||||||
# Get a second realm creation link.
|
result = self.submit_realm_creation_form(
|
||||||
result = self.client_post(
|
email, realm_subdomain=second_string_id, realm_name=second_realm_name
|
||||||
"/new/",
|
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": second_realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": second_string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@@ -1876,25 +1805,13 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
|
|
||||||
@override_settings(OPEN_REALM_CREATION=True)
|
@override_settings(OPEN_REALM_CREATION=True)
|
||||||
def test_invalid_email_signup(self) -> None:
|
def test_invalid_email_signup(self) -> None:
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email="<foo", realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": "<foo",
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assert_in_response("Please use your real email address.", result)
|
self.assert_in_response("Please use your real email address.", result)
|
||||||
|
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email="foo\x00bar", realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": "foo\x00bar",
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assert_in_response("Please use your real email address.", result)
|
self.assert_in_response("Please use your real email address.", result)
|
||||||
|
|
||||||
@@ -1921,26 +1838,14 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
"zephyr": "unavailable",
|
"zephyr": "unavailable",
|
||||||
}
|
}
|
||||||
for string_id, error_msg in errors.items():
|
for string_id, error_msg in errors.items():
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assert_in_response(error_msg, result)
|
self.assert_in_response(error_msg, result)
|
||||||
|
|
||||||
# test valid subdomain
|
# test valid subdomain
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="a-0", realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "a-0",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.client_get(result["Location"])
|
self.client_get(result["Location"])
|
||||||
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
||||||
@@ -1961,15 +1866,7 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
|
|
||||||
email = "user1@test.com"
|
email = "user1@test.com"
|
||||||
|
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(email, realm_subdomain="test", realm_name="Test")
|
||||||
"/new/",
|
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": "Test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "test",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
self.assert_in_response("Subdomain unavailable. Please choose a different one.", result)
|
self.assert_in_response("Subdomain unavailable. Please choose a different one.", result)
|
||||||
|
|
||||||
@override_settings(OPEN_REALM_CREATION=True)
|
@override_settings(OPEN_REALM_CREATION=True)
|
||||||
@@ -1980,27 +1877,13 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
|
|
||||||
# test root domain will fail with ROOT_DOMAIN_LANDING_PAGE
|
# test root domain will fail with ROOT_DOMAIN_LANDING_PAGE
|
||||||
with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
|
with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="", realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assert_in_response("unavailable", result)
|
self.assert_in_response("unavailable", result)
|
||||||
|
|
||||||
# test valid use of root domain
|
# test valid use of root domain
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(email, realm_subdomain="", realm_name=realm_name)
|
||||||
"/new/",
|
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
self.client_get(result["Location"])
|
self.client_get(result["Location"])
|
||||||
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
||||||
self.client_get(confirmation_url)
|
self.client_get(confirmation_url)
|
||||||
@@ -2021,29 +1904,16 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
|
|
||||||
# test root domain will fail with ROOT_DOMAIN_LANDING_PAGE
|
# test root domain will fail with ROOT_DOMAIN_LANDING_PAGE
|
||||||
with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
|
with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="abcdef", realm_name=realm_name, realm_in_root_domain="true"
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "abcdef",
|
|
||||||
"realm_in_root_domain": "true",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assert_in_response("unavailable", result)
|
self.assert_in_response("unavailable", result)
|
||||||
|
|
||||||
# test valid use of root domain
|
# test valid use of root domain
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="abcdef", realm_name=realm_name, realm_in_root_domain="true"
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "abcdef",
|
|
||||||
"realm_in_root_domain": "true",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.client_get(result["Location"])
|
self.client_get(result["Location"])
|
||||||
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
||||||
self.client_get(confirmation_url)
|
self.client_get(confirmation_url)
|
||||||
@@ -2207,14 +2077,8 @@ class UserSignUpTest(ZulipTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with smtp_mock, self.assertLogs(level="ERROR") as m:
|
with smtp_mock, self.assertLogs(level="ERROR") as m:
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain="zuliptest", realm_name="Zulip test"
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": "Zulip test",
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": "zuliptest",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self._assert_redirected_to(result, "/config-error/smtp")
|
self._assert_redirected_to(result, "/config-error/smtp")
|
||||||
@@ -2828,14 +2692,8 @@ class UserSignUpTest(ZulipTestCase):
|
|||||||
email = self.example_email("iago")
|
email = self.example_email("iago")
|
||||||
realm_name = "Test"
|
realm_name = "Test"
|
||||||
|
|
||||||
result = self.client_post(
|
result = self.submit_realm_creation_form(
|
||||||
"/new/",
|
email, realm_subdomain=realm.string_id, realm_name=realm_name
|
||||||
{
|
|
||||||
"email": email,
|
|
||||||
"realm_name": realm_name,
|
|
||||||
"realm_type": Realm.ORG_TYPES["business"]["id"],
|
|
||||||
"realm_subdomain": realm.string_id,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
self.assert_in_success_response(
|
self.assert_in_success_response(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user