Fix json overwriting if you have >1 PS4 connected (#35778)

This commit is contained in:
Boris Kaplounovsky authored and GitHub committed 2020-06-02 17:55:55 -07:00
1 parent e94228fddf
commit 2f6ffe7068
4 files changed
+16 -16

No files matched your search

+5 -5
View File
@@ -201,7 +201,7 @@ def test_games_reformat_to_dict(hass):
), patch("homeassistant.components.ps4.save_json", side_effect=MagicMock()), patch(
"os.path.isfile", return_value=True
):
mock_games = ps4.load_games(hass)
mock_games = ps4.load_games(hass, MOCK_ENTRY_ID)
# New format is a nested dict.
assert isinstance(mock_games, dict)
@@ -223,7 +223,7 @@ def test_load_games(hass):
), patch("homeassistant.components.ps4.save_json", side_effect=MagicMock()), patch(
"os.path.isfile", return_value=True
):
mock_games = ps4.load_games(hass)
mock_games = ps4.load_games(hass, MOCK_ENTRY_ID)
assert isinstance(mock_games, dict)
@@ -242,7 +242,7 @@ def test_loading_games_returns_dict(hass):
), patch("homeassistant.components.ps4.save_json", side_effect=MagicMock()), patch(
"os.path.isfile", return_value=True
):
mock_games = ps4.load_games(hass)
mock_games = ps4.load_games(hass, MOCK_ENTRY_ID)
assert isinstance(mock_games, dict)
assert not mock_games
@@ -252,7 +252,7 @@ def test_loading_games_returns_dict(hass):
), patch("homeassistant.components.ps4.save_json", side_effect=MagicMock()), patch(
"os.path.isfile", return_value=True
):
mock_games = ps4.load_games(hass)
mock_games = ps4.load_games(hass, MOCK_ENTRY_ID)
assert isinstance(mock_games, dict)
assert not mock_games
@@ -260,7 +260,7 @@ def test_loading_games_returns_dict(hass):
with patch("homeassistant.components.ps4.load_json", return_value=[]), patch(
"homeassistant.components.ps4.save_json", side_effect=MagicMock()
), patch("os.path.isfile", return_value=True):
mock_games = ps4.load_games(hass)
mock_games = ps4.load_games(hass, MOCK_ENTRY_ID)
assert isinstance(mock_games, dict)
assert not mock_games