-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
2 changed files
with
99 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
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 |
---|---|---|
|
@@ -166,6 +166,7 @@ def test_password(self) -> None: | |
self.assertEqual(uri.password, "secret") | ||
self.assertEqual(uri.parameters, {}) | ||
|
||
self.assertEqual(uri.global_phone_number, None) | ||
self.assertEqual(str(uri), "sip:alice:[email protected]") | ||
|
||
def test_password_escaped(self) -> None: | ||
|
@@ -178,6 +179,7 @@ def test_password_escaped(self) -> None: | |
self.assertEqual(uri.password, "sips:[email protected]") | ||
self.assertEqual(uri.parameters, {}) | ||
|
||
self.assertEqual(uri.global_phone_number, None) | ||
self.assertEqual(str(uri), "sip:alice:sips%3Auser%[email protected]") | ||
|
||
def test_rfc4475_wide_range_of_valid_characters(self) -> None: | ||
|
@@ -189,7 +191,42 @@ def test_rfc4475_wide_range_of_valid_characters(self) -> None: | |
self.assertEqual(uri.user, "1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*") | ||
self.assertEqual(uri.password, "&it+has=1,weird!*pas$wo~d_too.(doesn't-it)") | ||
self.assertEqual(uri.parameters, {}) | ||
|
||
self.assertEqual(uri.global_phone_number, None) | ||
self.assertEqual( | ||
str(uri), | ||
"sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*:&it+has=1,weird!*pas$wo~d_too.(doesn't-it)@example.com", | ||
) | ||
|
||
def test_tel_global_phone_number(self) -> None: | ||
uri = URI.parse("tel:+12015550123") | ||
self.assertEqual(uri.host, "") | ||
self.assertEqual(uri.user, "+12015550123") | ||
self.assertEqual(uri.password, None) | ||
self.assertEqual(uri.parameters, {}) | ||
|
||
self.assertEqual(uri.global_phone_number, "+12015550123") | ||
self.assertEqual(str(uri), "tel:+12015550123") | ||
|
||
def test_tel_uri_global_phone_number_with_visual_separators(self) -> None: | ||
uri = URI.parse("tel:+1-201-555-0123") | ||
self.assertEqual(uri.host, "") | ||
self.assertEqual(uri.user, "+1-201-555-0123") | ||
self.assertEqual(uri.password, None) | ||
self.assertEqual(uri.parameters, {}) | ||
|
||
self.assertEqual(uri.global_phone_number, "+12015550123") | ||
self.assertEqual(str(uri), "tel:+1-201-555-0123") | ||
|
||
def test_tel_uri_local_phone_number(self) -> None: | ||
uri = URI.parse("tel:7042;phone-context=example.com") | ||
self.assertEqual(uri.host, "") | ||
self.assertEqual(uri.user, "7042") | ||
self.assertEqual(uri.password, None) | ||
self.assertEqual( | ||
uri.parameters, | ||
{"phone-context": "example.com"}, | ||
) | ||
|
||
self.assertEqual(uri.global_phone_number, None) | ||
self.assertEqual(str(uri), "tel:7042;phone-context=example.com") |