-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ytdl-org:master' into fix-npo-support
- Loading branch information
Showing
8 changed files
with
342 additions
and
199 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ | |
sanitize_filename, | ||
sanitize_path, | ||
sanitize_url, | ||
sanitized_Request, | ||
shell_quote, | ||
smuggle_url, | ||
str_or_none, | ||
|
@@ -255,6 +256,18 @@ def test_sanitize_url(self): | |
self.assertEqual(sanitize_url('https://foo.bar'), 'https://foo.bar') | ||
self.assertEqual(sanitize_url('foo bar'), 'foo bar') | ||
|
||
def test_sanitized_Request(self): | ||
self.assertFalse(sanitized_Request('http://foo.bar').has_header('Authorization')) | ||
self.assertFalse(sanitized_Request('http://:foo.bar').has_header('Authorization')) | ||
self.assertEqual(sanitized_Request('http://@foo.bar').get_header('Authorization'), | ||
'Basic Og==') | ||
self.assertEqual(sanitized_Request('http://:[email protected]').get_header('Authorization'), | ||
'Basic OnBhc3M=') | ||
self.assertEqual(sanitized_Request('http://user:@foo.bar').get_header('Authorization'), | ||
'Basic dXNlcjo=') | ||
self.assertEqual(sanitized_Request('http://user:[email protected]').get_header('Authorization'), | ||
'Basic dXNlcjpwYXNz') | ||
|
||
def test_expand_path(self): | ||
def env(var): | ||
return '%{0}%'.format(var) if sys.platform == 'win32' else '${0}'.format(var) | ||
|
@@ -512,11 +525,14 @@ def test_float_or_none(self): | |
self.assertEqual(float_or_none(set()), None) | ||
|
||
def test_int_or_none(self): | ||
self.assertEqual(int_or_none(42), 42) | ||
self.assertEqual(int_or_none('42'), 42) | ||
self.assertEqual(int_or_none(''), None) | ||
self.assertEqual(int_or_none(None), None) | ||
self.assertEqual(int_or_none([]), None) | ||
self.assertEqual(int_or_none(set()), None) | ||
self.assertEqual(int_or_none('42', base=8), 34) | ||
self.assertRaises(TypeError, int_or_none(42, base=8)) | ||
|
||
def test_str_to_int(self): | ||
self.assertEqual(str_to_int('123,456'), 123456) | ||
|
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.