aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2017-05-01 23:09:18 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2017-05-04 16:26:17 +0800
commit0c265486016b06342fb257966474ce591667aaff (patch)
tree535a5d3331dd5be08e818174e630389485ad30ac /test
parent5401bea27fd6bcdd030e50f3af85145807eeab27 (diff)
downloadyoutube-dl-0c265486016b06342fb257966474ce591667aaff.zip
youtube-dl-0c265486016b06342fb257966474ce591667aaff.tar.gz
youtube-dl-0c265486016b06342fb257966474ce591667aaff.tar.bz2
[cda] Implement birthday verification (closes #12789)
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 05fdc0e..f31559e 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -44,6 +44,7 @@ from youtube_dl.utils import (
limit_length,
mimetype2ext,
month_by_name,
+ multipart_encode,
ohdave_rsa_encrypt,
OnDemandPagedList,
orderedSet,
@@ -620,6 +621,16 @@ class TestUtil(unittest.TestCase):
'http://example.com/path', {'test': '第二行тест'})),
query_dict('http://example.com/path?test=%E7%AC%AC%E4%BA%8C%E8%A1%8C%D1%82%D0%B5%D1%81%D1%82'))
+ def test_multipart_encode(self):
+ self.assertEqual(
+ multipart_encode({b'field': b'value'}, boundary='AAAAAA')[0],
+ b'--AAAAAA\r\nContent-Disposition: form-data; name="field"\r\n\r\nvalue\r\n--AAAAAA--\r\n')
+ self.assertEqual(
+ multipart_encode({'欄位'.encode('utf-8'): '值'.encode('utf-8')}, boundary='AAAAAA')[0],
+ b'--AAAAAA\r\nContent-Disposition: form-data; name="\xe6\xac\x84\xe4\xbd\x8d"\r\n\r\n\xe5\x80\xbc\r\n--AAAAAA--\r\n')
+ self.assertRaises(
+ ValueError, multipart_encode, {b'field': b'value'}, boundary='value')
+
def test_dict_get(self):
FALSE_VALUES = {
'none': None,