Add test for get_camera method. Downgrade travis lint to 3.5.3

This commit is contained in:
Kevin Fronczak
2019-03-01 13:52:13 -05:00
parent b536bd7eb5
commit 414eabd3ae
2 changed files with 22 additions and 2 deletions
+1 -2
View File
@@ -2,9 +2,8 @@ sudo: required
matrix:
fast_finish: true
include:
- python: "3.7"
- python: "3.5.3"
env: TOXENV=lint
dist: xenial
- python: "3.5.3"
env: TOXENV=py35
- python: "3.6"
+21
View File
@@ -163,3 +163,24 @@ class TestBlinkSetup(unittest.TestCase):
"""Check that we appropriately handle unexpected login info."""
mock_login.return_value = None
self.assertFalse(self.blink.get_auth_token())
@mock.patch('blinkpy.api.request_homescreen')
def test_get_cameras(self, mock_home, mock_sess):
"""Check retrieval of camera information."""
mock_home.return_value = {
'cameras': [{'name': 'foo', 'network_id': 1234, 'id': 5678},
{'name': 'bar', 'network_id': 1234, 'id': 5679},
{'name': 'test', 'network_id': 4321, 'id': 0000}]
}
result = self.blink.get_cameras()
self.assertEqual(result, {'1234': [{'name': 'foo', 'id': 5678},
{'name': 'bar', 'id': 5679}],
'4321': [{'name': 'test', 'id': 0000}]})
@mock.patch('blinkpy.api.request_homescreen')
def test_get_cameras_failure(self, mock_home, mock_sess):
"""Check that on failure we initialize empty info and move on."""
mock_home.return_value = {}
result = self.blink.get_cameras()
self.assertEqual(result, {})