Use a long enough JWT signing key in the Enphase Envoy tests (#179820)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Paulus Schoutsen
2026-08-22 10:18:05 -05:00
committed by GitHub
co-authored by Claude
parent 3befdedc5b
commit daaf982fe3
2 changed files with 9 additions and 7 deletions
+3 -1
View File
@@ -10,6 +10,8 @@ from homeassistant.util import dt as dt_util
from tests.common import MockConfigEntry
TOKEN_SIGNING_KEY = "envoy-test-signing-key-0123456789"
async def setup_integration(
hass: HomeAssistant,
@@ -31,6 +33,6 @@ def envoy_token(days_to_expiry: int = 365) -> str:
"name": "envoy",
"exp": (dt_util.utcnow() + timedelta(days=days_to_expiry)).timestamp(),
},
key="secret",
key=TOKEN_SIGNING_KEY,
algorithm="HS256",
)
+6 -6
View File
@@ -42,7 +42,7 @@ from homeassistant.helpers import (
)
from homeassistant.setup import async_setup_component
from . import setup_integration
from . import TOKEN_SIGNING_KEY, setup_integration
from tests.common import MockConfigEntry, async_capture_events, async_fire_time_changed
from tests.typing import WebSocketGenerator
@@ -72,7 +72,7 @@ async def test_token_in_config_file(
"""Test coordinator with token provided from config."""
token = encode(
payload={"name": "envoy", "exp": 1907837780},
key="secret",
key=TOKEN_SIGNING_KEY,
algorithm="HS256",
)
entry = MockConfigEntry(
@@ -105,7 +105,7 @@ async def test_expired_token_in_config(
current_token = encode(
# some time in 2021
payload={"name": "envoy", "exp": 1627314600},
key="secret",
key=TOKEN_SIGNING_KEY,
algorithm="HS256",
)
@@ -305,7 +305,7 @@ async def test_coordinator_token_refresh_error(
token = encode(
# some time in 2021
payload={"name": "envoy", "exp": 1627314600},
key="secret",
key=TOKEN_SIGNING_KEY,
algorithm="HS256",
)
entry = MockConfigEntry(
@@ -344,7 +344,7 @@ async def test_coordinator_first_update_auth_error(
current_token = encode(
# some time in future
payload={"name": "envoy", "exp": 1927314600},
key="secret",
key=TOKEN_SIGNING_KEY,
algorithm="HS256",
)
@@ -796,7 +796,7 @@ async def test_retry_timeout_settings(
"""Test coordinator with token provided from config."""
token = encode(
payload={"name": "envoy", "exp": 1907837780},
key="secret",
key=TOKEN_SIGNING_KEY,
algorithm="HS256",
)
entry = MockConfigEntry(