-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Escape plus sign in the username (#271)
- Loading branch information
Showing
2 changed files
with
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -410,6 +410,19 @@ def test_get_google_devices_json( | |
received_device[JSON_KEY_NETWORK_DEVICE][JSON_KEY_IP], ip_address | ||
) | ||
|
||
def test_username_escaping(self) -> None: | ||
"""Test that plus sign is escaped.""" | ||
self.assertEqual( | ||
self.client._escape_username("[email protected]"), "[email protected]" | ||
) | ||
self.assertEqual( | ||
self.client._escape_username("[email protected]"), | ||
"login%[email protected]", | ||
) | ||
self.assertEqual(self.client._escape_username("login"), "login") | ||
# Such account should be impossible to create. | ||
self.assertEqual(self.client._escape_username("login+tag"), "login%2Btag") | ||
|
||
|
||
class DeviceClientTests(TypeAssertions, TestCase): | ||
"""Device specific unittests""" | ||
|