diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-07-15 14:30:08 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-07-15 16:18:34 +0530 |
commit | c365dba8430ee33abda85d31f95128605bf240eb (patch) | |
tree | 174d35c23267863ca89a1a030935b445edf56799 /test/test_utils.py | |
parent | 1b392f905d20ef1f1b300b180f867d43c9ce49b8 (diff) | |
download | hypervideo-pre-c365dba8430ee33abda85d31f95128605bf240eb.tar.lz hypervideo-pre-c365dba8430ee33abda85d31f95128605bf240eb.tar.xz hypervideo-pre-c365dba8430ee33abda85d31f95128605bf240eb.zip |
[networking] Add module (#2861)
No actual changes - code is only moved around
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index bdbd2d879..862c7d0f7 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -258,15 +258,6 @@ class TestUtil(unittest.TestCase): self.assertEqual(sanitize_url('https://foo.bar'), 'https://foo.bar') self.assertEqual(sanitize_url('foo bar'), 'foo bar') - def test_extract_basic_auth(self): - auth_header = lambda url: sanitized_Request(url).get_header('Authorization') - self.assertFalse(auth_header('http://foo.bar')) - self.assertFalse(auth_header('http://:foo.bar')) - self.assertEqual(auth_header('http://@foo.bar'), 'Basic Og==') - self.assertEqual(auth_header('http://:pass@foo.bar'), 'Basic OnBhc3M=') - self.assertEqual(auth_header('http://user:@foo.bar'), 'Basic dXNlcjo=') - self.assertEqual(auth_header('http://user:pass@foo.bar'), 'Basic dXNlcjpwYXNz') - def test_expand_path(self): def env(var): return f'%{var}%' if sys.platform == 'win32' else f'${var}' @@ -2324,6 +2315,15 @@ Line 1 self.assertEqual(traverse_obj(mobj, lambda k, _: k in (0, 'group')), ['0123', '3'], msg='function on a `re.Match` should give group name as well') + def test_extract_basic_auth(self): + auth_header = lambda url: sanitized_Request(url).get_header('Authorization') + self.assertFalse(auth_header('http://foo.bar')) + self.assertFalse(auth_header('http://:foo.bar')) + self.assertEqual(auth_header('http://@foo.bar'), 'Basic Og==') + self.assertEqual(auth_header('http://:pass@foo.bar'), 'Basic OnBhc3M=') + self.assertEqual(auth_header('http://user:@foo.bar'), 'Basic dXNlcjo=') + self.assertEqual(auth_header('http://user:pass@foo.bar'), 'Basic dXNlcjpwYXNz') + if __name__ == '__main__': unittest.main() |