Skip to content

Commit

Permalink
Py3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mkmer committed Jan 2, 2024
1 parent 8555b7e commit 6a7203a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
23 changes: 16 additions & 7 deletions tests/test_camera_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ async def test_no_thumbnails(self, mock_resp):
"""Tests that thumbnail is 'None' if none found."""
mock_resp.return_value = "foobar"
self.camera.last_record = ["1"]
config = CONFIG | {
"thumbnail": "",
config = {
**CONFIG,
**{
"thumbnail": "",
},
}

self.camera.sync.homescreen = {"devices": []}
Expand Down Expand Up @@ -124,8 +127,11 @@ async def test_no_thumbnails(self, mock_resp):
async def test_no_video_clips(self, mock_resp):
"""Tests that we still proceed with camera setup with no videos."""
mock_resp.return_value = "foobar"
config = CONFIG | {
"thumbnail": "/foobar",
config = {
**CONFIG,
**{
"thumbnail": "/foobar",
},
}
mock_resp.return_value = mresp.MockResponse({"test": 200}, 200, raw_data="")
self.camera.sync.homescreen = {"devices": []}
Expand Down Expand Up @@ -359,9 +365,12 @@ async def test_save_recent_clips_exception(self, mock_clip, mock_open, mock_resp

async def test_missing_keys(self, mock_resp):
"""Tests missing signal keys."""
config = CONFIG | {
"signals": {"junk": 1},
"thumbnail": "",
config = {
**CONFIG,
**{
"signals": {"junk": 1},
"thumbnail": "",
},
}
self.camera.sync.homescreen = {"devices": []}
mock_resp.side_effect = [
Expand Down
14 changes: 10 additions & 4 deletions tests/test_cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ async def test_different_thumb_api(self, mock_resp):

async def test_thumb_return_none(self, mock_resp):
"""Test that a 'None" thumbnail is doesn't break system."""
config = CONFIG | {
"thumbnail": None,
config = {
**CONFIG,
**{
"thumbnail": None,
},
}
mock_resp.side_effect = [
{"temp": 71},
Expand All @@ -156,8 +159,11 @@ async def test_new_thumb_url_returned(self, mock_resp):
"/api/v3/media/accounts/9999/networks/5678/"
"test/1234/thumbnail/thumbnail.jpg?ts=1357924680&ext="
)
config = CONFIG | {
"thumbnail": thumb_return,
config = {
**CONFIG,
**{
"thumbnail": thumb_return,
},
}
mock_resp.side_effect = [
{"temp": 71},
Expand Down

0 comments on commit 6a7203a

Please sign in to comment.