Getting there...
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
[run]
|
||||
omit =
|
||||
helpers/*
|
||||
tests/*
|
||||
setup.py
|
||||
@@ -0,0 +1,9 @@
|
||||
## Description:
|
||||
|
||||
|
||||
**Related issue (if applicable):** fixes #<blinkpy issue number goes here>
|
||||
|
||||
## Checklist:
|
||||
- [ ] Local tests with `tox` run successfully **PR cannot be meged unless tests pass**
|
||||
- [ ] If user-facing functionality changed, README.rst updated
|
||||
- [ ] Tests added to verify new code works
|
||||
@@ -6,7 +6,5 @@ htmlcov/*
|
||||
*.pyc
|
||||
*.egg*/*
|
||||
dist/*
|
||||
MANIFEST
|
||||
README
|
||||
.sh
|
||||
build/*
|
||||
|
||||
@@ -96,10 +96,12 @@ Class Descriptions
|
||||
class BlinkCamera(config, urls)
|
||||
|
||||
The ``BlinkCamera`` class expects to receive:
|
||||
|
||||
* A dictionary ``config`` that contains the camera name, device id, armed status, thumbnail url, camera temperature, camery battery level, number of notifications, and region id
|
||||
* A ``BlinkURLHandler`` object that contains all the links necessary for communication.
|
||||
|
||||
Ultimately, this class is just a wrapper for each individual camera in order to make communication with individual cameras less clunky. The following properties/methods are availiable (in addition to the ones mentioned earlier):
|
||||
|
||||
* ``BlinkCamera.snap_picture()`` Takes an image with the camera and saves it as the new thumbnail. The ``Blink.refresh()`` method should be called after this if you want to store the new thumbnail link.
|
||||
* ``BlinkCamera.set_motion_detect(enable=True/False)`` Sending True to this function will enable motion detection for the camera. Setting to False will disable motion detection.
|
||||
* ``BlinkCamera.image_to_file(path)`` This will write the current thumbnail to the location indicated in 'path'
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
constants.py
|
||||
Generates constants for use in blinkpy
|
||||
'''
|
||||
import os
|
||||
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 4
|
||||
PATCH_VERSION = 4
|
||||
@@ -23,6 +25,8 @@ PROJECT_LONG_DESCRIPTION = ('blinkpy is an open-source '
|
||||
'system with the intention for easy '
|
||||
'integration into various home '
|
||||
'automation platforms.')
|
||||
if os.path.exists('README.rst'):
|
||||
PROJECT_LONG_DESCRIPTION = open('README.rst').read()
|
||||
PROJECT_CLASSIFIERS = [
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
|
||||
@@ -3,26 +3,13 @@ reports=no
|
||||
|
||||
# Reasons disabled:
|
||||
# locally-disabled - it spams too much
|
||||
# duplicate-code - unavoidable
|
||||
# cyclic-import - doesn't test if both import on load
|
||||
# abstract-class-little-used - prevents from setting right foundation
|
||||
# abstract-class-not-used - is flaky, should not show up but does
|
||||
# unused-argument - generic callbacks and setup methods create a lot of warnings
|
||||
# global-statement - used for the on-demand requirement installation
|
||||
# redefined-variable-type - this is Python, we're duck typing!
|
||||
# too-many-* - are not enforced for the sake of readability
|
||||
# too-few-* - same as too-many-*
|
||||
# abstract-method - with intro of async there are always methods missing
|
||||
|
||||
disable=
|
||||
locally-disabled,
|
||||
duplicate-code,
|
||||
cyclic-import,
|
||||
abstract-class-little-used,
|
||||
abstract-class-not-used,
|
||||
unused-argument,
|
||||
global-statement,
|
||||
redefined-variable-type,
|
||||
too-many-arguments,
|
||||
too-many-branches,
|
||||
too-many-instance-attributes,
|
||||
@@ -31,8 +18,4 @@ disable=
|
||||
too-many-return-statements,
|
||||
too-many-statements,
|
||||
too-many-lines,
|
||||
too-few-public-methods,
|
||||
abstract-method
|
||||
|
||||
[EXCEPTIONS]
|
||||
overgeneral-exceptions=Exception
|
||||
too-few-public-methods,
|
||||
@@ -24,6 +24,37 @@ class TestBlinkCameraSetup(unittest.TestCase):
|
||||
"""Clean up after test."""
|
||||
self.blink = None
|
||||
|
||||
@mock.patch('blinkpy.blinkpy.requests.post',
|
||||
side_effect=mresp.mocked_requests_post)
|
||||
@mock.patch('blinkpy.blinkpy.requests.get',
|
||||
side_effect=mresp.mocked_requests_get)
|
||||
def test_camera_properties(self, mock_get, mock_post):
|
||||
"""Tests all property set/recall."""
|
||||
test_value = 'foobar'
|
||||
self.blink.setup_system()
|
||||
for name in self.blink.cameras:
|
||||
camera = self.blink.cameras[name]
|
||||
camera.name = test_value
|
||||
camera.clip = test_value + '.mp4'
|
||||
camera.thumbnail = test_value + '.jpg'
|
||||
camera.temperature = 10
|
||||
camera.battery = 0
|
||||
camera.notifications = 100
|
||||
camera.image_link = test_value + '/image.jpg'
|
||||
camera.arm_link = test_value + '/arm'
|
||||
camera.header = {'foo': 'bar'}
|
||||
camera.motion = {'bar': 'foo'}
|
||||
self.assertEqual(camera.clip, test_value + '.mp4')
|
||||
self.assertEqual(camera.name, test_value)
|
||||
self.assertEqual(camera.thumbnail, test_value + '.jpg')
|
||||
self.assertEqual(camera.temperature, 10)
|
||||
self.assertEqual(camera.battery, 0)
|
||||
self.assertEqual(camera.notifications, 100)
|
||||
self.assertEqual(camera.image_link, test_value + '/image.jpg')
|
||||
self.assertEqual(camera.arm_link, test_value + '/arm')
|
||||
self.assertEqual(camera.header, {'foo': 'bar'})
|
||||
self.assertEqual(camera.motion, {'bar': 'foo'})
|
||||
|
||||
@mock.patch('blinkpy.blinkpy.requests.post',
|
||||
side_effect=mresp.mocked_requests_post)
|
||||
@mock.patch('blinkpy.blinkpy.requests.get',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
# Test blink camera functions
|
||||
@@ -0,0 +1 @@
|
||||
# Test functionality used for blink component in home assistant
|
||||
Reference in New Issue
Block a user