-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for lowercase email address
- Loading branch information
1 parent
3dfe5a5
commit 5153ba5
Showing
1 changed file
with
24 additions
and
0 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 |
---|---|---|
|
@@ -32,6 +32,11 @@ def pending_membership_not_registered_mixed_case_email(): | |
return mixer.blend(Membership, pending_email="[email protected]", user=None) | ||
|
||
|
||
@pytest.fixture | ||
def pending_membership_not_registered_lowercase_email(): | ||
return mixer.blend(Membership, pending_email="[email protected]", user=None) | ||
|
||
|
||
@mock_s3 | ||
def test_signup_signal_membership_update_with_mixed_case_email( | ||
client, access_tokens_google, pending_membership_not_registered_mixed_case_email, respx_mock | ||
|
@@ -49,3 +54,22 @@ def test_signup_signal_membership_update_with_mixed_case_email( | |
|
||
membership = Membership.objects.get(id=pending_membership_not_registered_mixed_case_email.id) | ||
assert membership.user is not None | ||
|
||
|
||
@mock_s3 | ||
def test_signup_signal_membership_update_with_lowercase_email( | ||
client, access_tokens_google, pending_membership_not_registered_lowercase_email, respx_mock | ||
): | ||
membership = Membership.objects.get(id=pending_membership_not_registered_lowercase_email.id) | ||
assert membership.user is None | ||
|
||
respx_mock.post(GoogleProvider.GOOGLE_TOKEN_URI).mock( | ||
return_value=Response(200, json=access_tokens_google) | ||
) | ||
url = reverse("terraso_auth:google-callback") | ||
response = client.get(url, {"code": "testing-code-google-auth"}) | ||
|
||
assert response.status_code == 302 | ||
|
||
membership = Membership.objects.get(id=pending_membership_not_registered_lowercase_email.id) | ||
assert membership.user is not None |