mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-11 01:48:03 +00:00
Support Unicode strings in encrypt/decrypt (#125)
This commit is contained in:

committed by
Teemu R

parent
e612560b35
commit
a6d515b5cb
@@ -10,3 +10,23 @@ class TestTPLinkSmartHomeProtocol(TestCase):
|
||||
# encrypt adds a 4 byte header
|
||||
encrypted = encrypted[4:]
|
||||
self.assertEqual(d, TPLinkSmartHomeProtocol.decrypt(encrypted))
|
||||
|
||||
def test_encrypt_unicode(self):
|
||||
d = "{'snowman': '\u2603'}"
|
||||
|
||||
e = bytes([208, 247, 132, 234, 133, 242, 159, 254, 144, 183,
|
||||
141, 173, 138, 104, 240, 115, 84, 41])
|
||||
|
||||
encrypted = TPLinkSmartHomeProtocol.encrypt(d)
|
||||
# encrypt adds a 4 byte header
|
||||
encrypted = encrypted[4:]
|
||||
|
||||
self.assertEqual(e, encrypted)
|
||||
|
||||
def test_decrypt_unicode(self):
|
||||
e = bytes([208, 247, 132, 234, 133, 242, 159, 254, 144, 183,
|
||||
141, 173, 138, 104, 240, 115, 84, 41])
|
||||
|
||||
d = "{'snowman': '\u2603'}"
|
||||
|
||||
self.assertEqual(d, TPLinkSmartHomeProtocol.decrypt(e))
|
||||
|
Reference in New Issue
Block a user