Skip to content

Commit

Permalink
Merge pull request #314 from fronzbot/fix-return-error
Browse files Browse the repository at this point in the history
Fix error with updating owl information during refresh
  • Loading branch information
fronzbot authored Jun 16, 2020
2 parents 130b5ac + 22e4b7d commit e02b429
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion blinkpy/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MAJOR_VERSION = 0
MINOR_VERSION = 16
PATCH_VERSION = "0-rc7"
PATCH_VERSION = "0-rc8"

__version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}"

Expand Down
6 changes: 4 additions & 2 deletions blinkpy/sync_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_camera_info(self, camera_id, **kwargs):
return response["camera"][0]
except (TypeError, KeyError):
_LOGGER.error("Could not extract camera info: %s", response, exc_info=True)
return []
return {}

def get_network_info(self):
"""Retrieve network status."""
Expand All @@ -191,7 +191,9 @@ def refresh(self, force_cache=False):
self.check_new_videos()
for camera_name in self.cameras.keys():
camera_id = self.cameras[camera_name].camera_id
camera_info = self.get_camera_info(camera_id)
camera_info = self.get_camera_info(
camera_id, owl_info=self.get_owl_info(camera_name)
)
self.cameras[camera_name].update(camera_info, force_cache=force_cache)
self.available = True

Expand Down
6 changes: 3 additions & 3 deletions tests/test_sync_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def test_get_camera_info(self, mock_resp):
def test_get_camera_info_fail(self, mock_resp):
"""Test handling of failed get camera info function."""
mock_resp.return_value = None
self.assertEqual(self.blink.sync["test"].get_camera_info("1"), [])
self.assertEqual(self.blink.sync["test"].get_camera_info("1"), {})
mock_resp.return_value = {}
self.assertEqual(self.blink.sync["test"].get_camera_info("1"), [])
self.assertEqual(self.blink.sync["test"].get_camera_info("1"), {})
mock_resp.return_value = {"camera": None}
self.assertEqual(self.blink.sync["test"].get_camera_info("1"), [])
self.assertEqual(self.blink.sync["test"].get_camera_info("1"), {})

def test_get_network_info(self, mock_resp):
"""Test network retrieval."""
Expand Down

0 comments on commit e02b429

Please sign in to comment.