mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 11:43:34 +00:00
86f14642c8
* move is_off property to SmartDevice, implement is_on for bulb and use it * refactor by moving smartbulb and smartplug to their own classes * drop python2 compatibility, make flake8 happy * travis: remove 2.7, add 3.6
13 lines
409 B
Python
13 lines
409 B
Python
from unittest import TestCase
|
|
from ..protocol import TPLinkSmartHomeProtocol
|
|
import json
|
|
|
|
|
|
class TestTPLinkSmartHomeProtocol(TestCase):
|
|
def test_encrypt(self):
|
|
d = json.dumps({'foo': 1, 'bar': 2})
|
|
encrypted = TPLinkSmartHomeProtocol.encrypt(d)
|
|
# encrypt adds a 4 byte header
|
|
encrypted = encrypted[4:]
|
|
self.assertEqual(d, TPLinkSmartHomeProtocol.decrypt(encrypted))
|