mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
16 lines
525 B
Python
16 lines
525 B
Python
|
from __future__ import absolute_import
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
from unittest import TestCase
|
||
|
from pyHS100.protocol import TPLinkSmartHomeProtocol
|
||
|
import json
|
||
|
|
||
|
|
||
|
class TestTPLinkSmartHomeProtocol(TestCase):
|
||
|
def test_encrypt(self):
|
||
|
d = json.dumps({'foo': 1, 'bar': 2})
|
||
|
encrypted = TPLinkSmartHomeProtocol.encrypt(d)
|
||
|
# encrypt appends nullbytes for the protocol sends
|
||
|
encrypted = encrypted.lstrip(b'\0')
|
||
|
self.assertEqual(d, TPLinkSmartHomeProtocol.decrypt(encrypted))
|