about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorXie Yanbo <xieyanbo@gmail.com>2022-10-11 20:55:09 +0800
committerGitHub <noreply@github.com>2022-10-11 13:55:09 +0100
commitc91cbf60729af93c4677864aa6c8b74b576146ca (patch)
tree56020436e3de9bd9182fcfa438be501db615b55d /test
parent11b284c81fe2988813c817918536fc3a5630870a (diff)
downloadyoutube-dl-c91cbf60729af93c4677864aa6c8b74b576146ca.tar.gz
youtube-dl-c91cbf60729af93c4677864aa6c8b74b576146ca.tar.xz
youtube-dl-c91cbf60729af93c4677864aa6c8b74b576146ca.zip
[netease] Get netease music download url through player api (#31235)
* remove unplayable song from test
* compatible with python 2
* using standard User_Agent, fix imports
* use hash instead of long description
* fix lint
* fix hash
Diffstat (limited to 'test')
-rw-r--r--test/test_aes.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/test_aes.py b/test/test_aes.py
index cc89fb6ab..0f181466b 100644
--- a/test/test_aes.py
+++ b/test/test_aes.py
@@ -8,7 +8,7 @@ import sys
 import unittest
 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
-from youtube_dl.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text
+from youtube_dl.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text, aes_ecb_encrypt
 from youtube_dl.utils import bytes_to_intlist, intlist_to_bytes
 import base64
 
@@ -58,6 +58,13 @@ class TestAES(unittest.TestCase):
         decrypted = (aes_decrypt_text(encrypted, password, 32))
         self.assertEqual(decrypted, self.secret_msg)
 
+    def test_ecb_encrypt(self):
+        data = bytes_to_intlist(self.secret_msg)
+        encrypted = intlist_to_bytes(aes_ecb_encrypt(data, self.key))
+        self.assertEqual(
+            encrypted,
+            b'\xaa\x86]\x81\x97>\x02\x92\x9d\x1bR[[L/u\xd3&\xd1(h\xde{\x81\x94\xba\x02\xae\xbd\xa6\xd0:')
+
 
 if __name__ == '__main__':
     unittest.main()