-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c48106
commit ef28610
Showing
1 changed file
with
0 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -695,37 +695,6 @@ def run_test_for_allowed_domain( | |
# Check that the user was still created and added to the organization | ||
self.assertEqual(user.organization, new_org) | ||
|
||
def test_api_signup_with_sso_enforced_fails(self): | ||
"""Test that users cannot sign up directly when SSO is enforced.""" | ||
|
||
# Create an organization with SSO enforcement | ||
organization = Organization.objects.create(name="Test Org") | ||
invite: OrganizationInvite = OrganizationInvite.objects.create( | ||
target_email="[email protected]", organization=organization | ||
) | ||
|
||
response = self.client.post( | ||
f"/api/signup/{invite.id}/", | ||
{ | ||
"first_name": "Alice", | ||
"password": VALID_TEST_PASSWORD, | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual( | ||
response.json(), | ||
{ | ||
"type": "validation_error", | ||
"code": "sso_enforced", | ||
"detail": "You cannot sign up by email when SSO is enforced.", | ||
"attr": None, | ||
}, | ||
) | ||
|
||
# Verify no user was created | ||
self.assertFalse(User.objects.filter(email="[email protected]").exists()) | ||
|
||
@patch("posthoganalytics.capture") | ||
@mock.patch("social_core.backends.base.BaseAuth.request") | ||
@mock.patch("posthog.api.authentication.get_instance_available_sso_providers") | ||
|