-
-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use better regex for IPv6 to allow a lot more valid IPv6 addresses (#753
) * Use better regex for IPv6 to allow a lot more valid IPv6 addresses * Adding some unit tests for is_absolute_uri in uri_validate * Make unit tests Python 3.6 compatible * Remove redundant import after unit test simplification for py36 * update Changelog * Remove redundant coding line
- Loading branch information
1 parent
7c0b505
commit 2b8a448
Showing
3 changed files
with
39 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import oauthlib | ||
from oauthlib.uri_validate import is_absolute_uri | ||
|
||
from tests.unittest import TestCase | ||
|
||
|
||
class UriValidateTest(TestCase): | ||
|
||
def test_is_absolute_uri(self): | ||
|
||
self.assertIsNotNone(is_absolute_uri('schema://example.com/path')) | ||
self.assertIsNotNone(is_absolute_uri('https://example.com/path')) | ||
self.assertIsNotNone(is_absolute_uri('https://example.com')) | ||
self.assertIsNotNone(is_absolute_uri('https://example.com:443/path')) | ||
self.assertIsNotNone(is_absolute_uri('https://example.com:443/')) | ||
self.assertIsNotNone(is_absolute_uri('https://example.com:443')) | ||
self.assertIsNotNone(is_absolute_uri('http://example.com')) | ||
self.assertIsNotNone(is_absolute_uri('http://example.com/path')) | ||
self.assertIsNotNone(is_absolute_uri('http://example.com:80/path')) | ||
self.assertIsNotNone(is_absolute_uri('com.example.bundle.id:/')) | ||
self.assertIsNotNone(is_absolute_uri('http://[::1]:38432/path')) | ||
self.assertIsNotNone(is_absolute_uri('http://[::1]/path')) | ||
self.assertIsNotNone(is_absolute_uri('http://[fd01:0001::1]/path')) | ||
self.assertIsNotNone(is_absolute_uri('http://[fd01:1::1]/path')) | ||
self.assertIsNotNone(is_absolute_uri('http://[0123:4567:89ab:cdef:0123:4567:89ab:cdef]/path')) | ||
self.assertIsNotNone(is_absolute_uri('http://127.0.0.1:38432/')) | ||
self.assertIsNotNone(is_absolute_uri('http://127.0.0.1:38432/')) | ||
self.assertIsNotNone(is_absolute_uri('http://127.1:38432/')) | ||
|
||
self.assertIsNone(is_absolute_uri('http://example.com:notaport/path')) | ||
self.assertIsNone(is_absolute_uri('wrong')) | ||
self.assertIsNone(is_absolute_uri('http://[:1]:38432/path')) | ||
self.assertIsNone(is_absolute_uri('http://[abcd:efgh::1]/')) |