aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-02-07 03:22:29 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-02-08 07:28:46 +0530
commitf6a765ceb59c55aea06921880c1c87d1ff36e5de (patch)
tree4120a1128be7c3ec48f0d81f6832fe55e25cff5b /test
parent754c84e2e416cf6609dd0e4632b4985a08d34043 (diff)
downloadhypervideo-pre-f6a765ceb59c55aea06921880c1c87d1ff36e5de.tar.lz
hypervideo-pre-f6a765ceb59c55aea06921880c1c87d1ff36e5de.tar.xz
hypervideo-pre-f6a765ceb59c55aea06921880c1c87d1ff36e5de.zip
[dependencies] Standardize `Cryptodome` imports
Diffstat (limited to 'test')
-rw-r--r--test/test_aes.py6
-rw-r--r--test/test_compat.py3
2 files changed, 6 insertions, 3 deletions
diff --git a/test/test_aes.py b/test/test_aes.py
index 8e8fc0b3e..18f15fecb 100644
--- a/test/test_aes.py
+++ b/test/test_aes.py
@@ -26,7 +26,7 @@ from yt_dlp.aes import (
key_expansion,
pad_block,
)
-from yt_dlp.dependencies import Cryptodome_AES
+from yt_dlp.dependencies import Cryptodome
from yt_dlp.utils import bytes_to_intlist, intlist_to_bytes
# the encrypted data can be generate with 'devscripts/generate_aes_testdata.py'
@@ -48,7 +48,7 @@ class TestAES(unittest.TestCase):
data = b'\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6\x27\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd'
decrypted = intlist_to_bytes(aes_cbc_decrypt(bytes_to_intlist(data), self.key, self.iv))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
- if Cryptodome_AES:
+ if Cryptodome:
decrypted = aes_cbc_decrypt_bytes(data, intlist_to_bytes(self.key), intlist_to_bytes(self.iv))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
@@ -78,7 +78,7 @@ class TestAES(unittest.TestCase):
decrypted = intlist_to_bytes(aes_gcm_decrypt_and_verify(
bytes_to_intlist(data), self.key, bytes_to_intlist(authentication_tag), self.iv[:12]))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
- if Cryptodome_AES:
+ if Cryptodome:
decrypted = aes_gcm_decrypt_and_verify_bytes(
data, intlist_to_bytes(self.key), authentication_tag, intlist_to_bytes(self.iv[:12]))
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
diff --git a/test/test_compat.py b/test/test_compat.py
index e3d775bc1..003a97abf 100644
--- a/test/test_compat.py
+++ b/test/test_compat.py
@@ -31,6 +31,9 @@ class TestCompat(unittest.TestCase):
# TODO: Test submodule
# compat.asyncio.events # Must not raise error
+ with self.assertWarns(DeprecationWarning):
+ compat.compat_pycrypto_AES # Must not raise error
+
def test_compat_expanduser(self):
old_home = os.environ.get('HOME')
test_str = R'C:\Documents and Settings\ั‚ะตัั‚\Application Data'