162 lines
4.9 KiB
Diff
162 lines
4.9 KiB
Diff
diff --git a/pyvera.egg-info/SOURCES.txt b/pyvera.egg-info/SOURCES.txt
|
|
index 11ee3fd..dfa0814 100644
|
|
--- a/pyvera.egg-info/SOURCES.txt
|
|
+++ b/pyvera.egg-info/SOURCES.txt
|
|
@@ -8,5 +8,3 @@ pyvera.egg-info/dependency_links.txt
|
|
pyvera.egg-info/requires.txt
|
|
pyvera.egg-info/top_level.txt
|
|
pyvera.egg-info/zip-safe
|
|
-tests/__init__.py
|
|
-tests/subscribe.py
|
|
\ No newline at end of file
|
|
diff --git a/pyvera.egg-info/top_level.txt b/pyvera.egg-info/top_level.txt
|
|
index d8c25e6..c4a9d5f 100644
|
|
--- a/pyvera.egg-info/top_level.txt
|
|
+++ b/pyvera.egg-info/top_level.txt
|
|
@@ -1,2 +1 @@
|
|
pyvera
|
|
-tests
|
|
diff --git a/setup.py b/setup.py
|
|
index 990f7fa..49f05c3 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -9,5 +9,4 @@ setup(name='pyvera',
|
|
license='MIT',
|
|
install_requires=['requests>=2.0'],
|
|
packages=find_packages(),
|
|
- test_suite="tests",
|
|
zip_safe=True)
|
|
diff --git a/tests/__init__.py b/tests/__init__.py
|
|
deleted file mode 100644
|
|
index deaddff..0000000
|
|
--- a/tests/__init__.py
|
|
+++ /dev/null
|
|
@@ -1,37 +0,0 @@
|
|
-import unittest
|
|
-import mock
|
|
-import json
|
|
-import logging
|
|
-
|
|
-import sys
|
|
-import os
|
|
-sys.path.insert(0, os.path.abspath('..'))
|
|
-import pyvera
|
|
-
|
|
-#pyvera.logger = mock.create_autospec(logging.Logger)
|
|
-logging.basicConfig(level=logging.DEBUG)
|
|
-pyvera.logger = logging.getLogger(__name__)
|
|
-
|
|
-class TestVeraLock(unittest.TestCase):
|
|
- def test_set_lock_state(self):
|
|
-
|
|
- mock_controller = mock.create_autospec(pyvera.VeraController)
|
|
- status_json = json.loads(
|
|
- '{'
|
|
- ' "id": 33,'
|
|
- ' "deviceInfo": {'
|
|
- # pyvera.CATEGORY_LOCK
|
|
- ' "category": 7,'
|
|
- ' "categoryName": "Doorlock",'
|
|
- ' "name": "MyTestDeadbolt",'
|
|
- ' "locked": 0'
|
|
- ' }'
|
|
- '}'
|
|
- )
|
|
- lock = pyvera.VeraLock(status_json, mock_controller)
|
|
- lock.set_lock_state(1)
|
|
- self.assertTrue(lock.get_value('locked'), '1')
|
|
-
|
|
-if __name__ == '__main__':
|
|
- unittest.main()
|
|
-
|
|
diff --git a/tests/subscribe.py b/tests/subscribe.py
|
|
deleted file mode 100644
|
|
index 0df62a5..0000000
|
|
--- a/tests/subscribe.py
|
|
+++ /dev/null
|
|
@@ -1,84 +0,0 @@
|
|
-import unittest
|
|
-import mock
|
|
-import json
|
|
-import logging
|
|
-
|
|
-import sys
|
|
-import os
|
|
-sys.path.insert(0, os.path.abspath('..'))
|
|
-import pyvera
|
|
-
|
|
-#pyvera.logger = mock.create_autospec(logging.Logger)
|
|
-logging.basicConfig(level=logging.DEBUG)
|
|
-pyvera.logger = logging.getLogger(__name__)
|
|
-
|
|
-class TestSubscriptionRegistry(unittest.TestCase):
|
|
- def test__event_device_for_vera_lock_status(self):
|
|
-
|
|
- sr = pyvera.SubscriptionRegistry()
|
|
- mock_lock = mock.create_autospec(pyvera.VeraLock)
|
|
- mock_lock.name = mock.MagicMock(return_value='MyTestDeadbolt')
|
|
-
|
|
- # Deadbolt changing but not done
|
|
- device_json = json.loads(
|
|
- '{'
|
|
- # subscribe.STATE_JOB_IN_PROGRESS
|
|
- ' "state": "1"'
|
|
- '}'
|
|
- )
|
|
- sr._event_device(mock_lock, device_json)
|
|
- mock_lock.update.assert_not_called()
|
|
-
|
|
- # Deadbolt progress with reset state but not done
|
|
- device_json = json.loads(
|
|
- '{'
|
|
- # subscribe.STATE_NO_JOB
|
|
- ' "state": "-1",'
|
|
- ' "comment": "MyTestDeadbolt: Sending the Z-Wave command after 0 retries"'
|
|
- '}'
|
|
- )
|
|
- sr._event_device(mock_lock, device_json)
|
|
- mock_lock.update.assert_not_called()
|
|
-
|
|
- # Deadbolt progress locked but not done
|
|
- device_json = json.loads(
|
|
- '{'
|
|
- # subscribe.STATE_JOB_IN_PROGRESS
|
|
- ' "state": "1",'
|
|
- ' "locked": "1",'
|
|
- ' "comment": "MyTestDeadbolt"'
|
|
- '}'
|
|
- )
|
|
- sr._event_device(mock_lock, device_json)
|
|
- mock_lock.update.assert_not_called()
|
|
-
|
|
- # Deadbolt progress with status but not done
|
|
- device_json = json.loads(
|
|
- '{'
|
|
- # subscribe.STATE_JOB_IN_PROGRESS
|
|
- ' "state": "1",'
|
|
- ' "comment": "MyTestDeadbolt: Please wait! Polling node"'
|
|
- '}'
|
|
- )
|
|
- sr._event_device(mock_lock, device_json)
|
|
- mock_lock.update.assert_not_called()
|
|
-
|
|
- # Deadbolt progress complete
|
|
- device_json = json.loads(
|
|
- '{'
|
|
- # subscribe.STATE_JOB_IN_PROGRESS
|
|
- ' "state": "1",'
|
|
- ' "locked": "1",'
|
|
- ' "comment": "MyTestDeadbolt: SUCCESS! Successfully polled node",'
|
|
- ' "deviceInfo": {'
|
|
- # pyvera.CATEGORY_LOCK
|
|
- ' "category": 7'
|
|
- ' }'
|
|
- '}'
|
|
- )
|
|
- sr._event_device(mock_lock, device_json)
|
|
- mock_lock.update.assert_called_once_with(device_json)
|
|
-
|
|
-if __name__ == '__main__':
|
|
- unittest.main()
|
|
-
|