-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from ahivert/fix-178
fix: keep only the first ip to match postgres inet type
- Loading branch information
Showing
3 changed files
with
15 additions
and
2 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
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
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 |
---|---|---|
|
@@ -447,6 +447,19 @@ def test_clear_expired_tokens(self): | |
# there should be zero tokens | ||
self.assertEqual(ResetPasswordToken.objects.all().count(), 0) | ||
|
||
def test_generate_token_for_email_with_multiple_ip_address(self): | ||
""" | ||
Test generating tokens with multiple ip address will keep only the first | ||
one to match inet type | ||
https://www.postgresql.org/docs/current/datatype-net-types.html#DATATYPE-INET | ||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#syntax | ||
""" | ||
# request a new token with multiple ips | ||
generate_token_for_email(email="[email protected]", ip_address="1.1.1.1, 2.2.2.2") | ||
|
||
# there should be one token with only the first ip adress | ||
self.assertEqual(ResetPasswordToken.objects.get().ip_address, "1.1.1.1") | ||
|
||
def test_generate_token_for_email(self): | ||
""" Tests generating tokens for a specific email address programmatically """ | ||
|
||
|