-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 4312-return-search-scores-api
- Loading branch information
Showing
3 changed files
with
57 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,6 +275,50 @@ async def test_signing_in(self) -> None: | |
) | ||
self.assertRedirects(r, "/") | ||
|
||
async def test_registration_rejects_malicious_first_name_input( | ||
self, | ||
) -> None: | ||
tests = ( | ||
# Invalid | ||
("evil.com", False), | ||
("http://test", False), | ||
("[email protected]", False), | ||
("/test/", False), | ||
# Valid | ||
("My fullname", True), | ||
("Test Test", True), | ||
("Éric Terrien-Pascal", True), | ||
("Tel'c", True), | ||
) | ||
for first_name, is_valid in tests: | ||
with self.subTest( | ||
f"Trying to register using {first_name} as first name.", | ||
first_name=first_name, | ||
is_valid=is_valid, | ||
): | ||
r = await self.async_client.post( | ||
reverse("register"), | ||
{ | ||
"username": "aamon", | ||
"email": "[email protected]", | ||
"password1": "a", | ||
"password2": "a", | ||
"first_name": first_name, | ||
"last_name": "Marquis of Hell", | ||
"skip_me_if_alive": "", | ||
}, | ||
) | ||
if not is_valid: | ||
self.assertIn( | ||
"First name must not contain any special characters.", | ||
r.content.decode(), | ||
) | ||
else: | ||
self.assertNotIn( | ||
"First name must not contain any special characters.", | ||
r.content.decode(), | ||
) | ||
|
||
async def test_confirming_an_email_address(self) -> None: | ||
"""Tests whether we can confirm the case where an email is associated | ||
with a single account. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.