1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 17:49:37 +01:00

Bump PSNAWP to 3.0.1 (#155579)

This commit is contained in:
Manu
2025-11-01 06:23:32 +01:00
committed by GitHub
parent 7f84363bf4
commit c22a2b93fa
7 changed files with 26 additions and 26 deletions
@@ -5,7 +5,6 @@ from __future__ import annotations
from abc import abstractmethod
from dataclasses import dataclass
from datetime import timedelta
import json
import logging
from typing import TYPE_CHECKING, Any
@@ -175,10 +174,6 @@ class PlaystationNetworkGroupsUpdateCoordinator(
}
)
except PSNAWPForbiddenError as e:
try:
error = json.loads(e.args[0])
except json.JSONDecodeError as err:
raise PSNAWPServerError from err
ir.async_create_issue(
self.hass,
DOMAIN,
@@ -189,7 +184,7 @@ class PlaystationNetworkGroupsUpdateCoordinator(
translation_key="group_chat_forbidden",
translation_placeholders={
CONF_NAME: self.config_entry.title,
"error_message": error["error"]["message"],
"error_message": e.message or "",
},
)
await self.async_shutdown()
@@ -81,5 +81,5 @@
"integration_type": "service",
"iot_class": "cloud_polling",
"quality_scale": "bronze",
"requirements": ["PSNAWP==3.0.0", "pyrate-limiter==3.9.0"]
"requirements": ["PSNAWP==3.0.1", "pyrate-limiter==3.9.0"]
}
+1 -1
View File
@@ -25,7 +25,7 @@ HATasmota==0.10.1
Mastodon.py==2.1.2
# homeassistant.components.playstation_network
PSNAWP==3.0.0
PSNAWP==3.0.1
# homeassistant.components.doods
# homeassistant.components.generic
+1 -1
View File
@@ -25,7 +25,7 @@ HATasmota==0.10.1
Mastodon.py==2.1.2
# homeassistant.components.playstation_network
PSNAWP==3.0.0
PSNAWP==3.0.1
# homeassistant.components.doods
# homeassistant.components.generic
@@ -119,9 +119,9 @@ async def test_form_already_configured_as_subentry(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("raise_error", "text_error"),
[
(PSNAWPNotFoundError(), "invalid_account"),
(PSNAWPAuthenticationError(), "invalid_auth"),
(PSNAWPError(), "cannot_connect"),
(PSNAWPNotFoundError("error msg"), "invalid_account"),
(PSNAWPAuthenticationError("error msg"), "invalid_auth"),
(PSNAWPError("error msg"), "cannot_connect"),
(Exception(), "unknown"),
],
)
@@ -169,7 +169,7 @@ async def test_parse_npsso_token_failures(
mock_psnawp_npsso: MagicMock,
) -> None:
"""Test parse_npsso_token raises the correct exceptions during config flow."""
mock_psnawp_npsso.side_effect = PSNAWPInvalidTokenError
mock_psnawp_npsso.side_effect = PSNAWPInvalidTokenError("error msg")
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
@@ -221,9 +221,9 @@ async def test_flow_reauth(
@pytest.mark.parametrize(
("raise_error", "text_error"),
[
(PSNAWPNotFoundError(), "invalid_account"),
(PSNAWPAuthenticationError(), "invalid_auth"),
(PSNAWPError(), "cannot_connect"),
(PSNAWPNotFoundError("error msg"), "invalid_account"),
(PSNAWPAuthenticationError("error msg"), "invalid_auth"),
(PSNAWPError("error msg"), "cannot_connect"),
(Exception(), "unknown"),
],
)
@@ -287,7 +287,7 @@ async def test_flow_reauth_token_error(
assert config_entry.state is ConfigEntryState.LOADED
mock_psnawp_npsso.side_effect = PSNAWPInvalidTokenError
mock_psnawp_npsso.side_effect = PSNAWPInvalidTokenError("error msg")
result = await config_entry.start_reauth_flow(hass)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "reauth_confirm"
@@ -49,7 +49,7 @@ async def test_config_entry_auth_failed(
) -> None:
"""Test config entry auth failed setup error."""
mock_psnawpapi.user.side_effect = PSNAWPAuthenticationError
mock_psnawpapi.user.side_effect = PSNAWPAuthenticationError("error msg")
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@@ -95,7 +95,7 @@ async def test_coordinator_update_auth_failed(
"""Test coordinator update auth failed setup error."""
mock_psnawpapi.user.return_value.get_presence.side_effect = (
PSNAWPAuthenticationError
PSNAWPAuthenticationError("error msg")
)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
@@ -152,7 +152,7 @@ async def test_trophy_title_coordinator_auth_failed(
assert config_entry.state is ConfigEntryState.LOADED
mock_psnawpapi.user.return_value.trophy_titles.side_effect = (
PSNAWPAuthenticationError
PSNAWPAuthenticationError("error msg")
)
freezer.tick(timedelta(days=1))
@@ -300,10 +300,10 @@ async def test_friends_coordinator_update_data_failed(
@pytest.mark.parametrize(
("exception", "state"),
[
(PSNAWPNotFoundError, ConfigEntryState.SETUP_ERROR),
(PSNAWPAuthenticationError, ConfigEntryState.SETUP_ERROR),
(PSNAWPServerError, ConfigEntryState.SETUP_RETRY),
(PSNAWPClientError, ConfigEntryState.SETUP_RETRY),
(PSNAWPNotFoundError("error msg"), ConfigEntryState.SETUP_ERROR),
(PSNAWPAuthenticationError("error msg"), ConfigEntryState.SETUP_ERROR),
(PSNAWPServerError("error msg"), ConfigEntryState.SETUP_RETRY),
(PSNAWPClientError("error msg"), ConfigEntryState.SETUP_RETRY),
],
)
async def test_friends_coordinator_setup_failed(
@@ -332,7 +332,7 @@ async def test_friends_coordinator_auth_failed(
"""Test friends coordinator starts reauth on authentication error."""
mock = mock_psnawpapi.user.return_value.friends_list.return_value[0]
mock.profile.side_effect = PSNAWPAuthenticationError
mock.profile.side_effect = PSNAWPAuthenticationError("error msg")
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
@@ -101,7 +101,12 @@ async def test_send_message(
@pytest.mark.parametrize(
"exception",
[PSNAWPClientError, PSNAWPForbiddenError, PSNAWPNotFoundError, PSNAWPServerError],
[
PSNAWPClientError("error msg"),
PSNAWPForbiddenError("error msg"),
PSNAWPNotFoundError("error msg"),
PSNAWPServerError("error msg"),
],
)
async def test_send_message_exceptions(
hass: HomeAssistant,