Add additional zeroconf discovery coverage and logging to enphase_envoy (#114405)
* add debug info to zeroconf for enphase_envoy * Implement review feedback, lost space Co-authored-by: Charles Garwood <cgarwood@newdealmultimedia.com> * review feedback textual changes. * implement review feedbackw.py Co-authored-by: J. Nick Koston <nick@koston.org> * Add some more zeroconf tests and valid jwt * review feedback assert abort reason and keyerror for serialnumber * Review feedback config flow test ends with abort or create_entry * Review feedback optimize resource usage * Cover new code in test. * Use caplog for debug COV --------- Co-authored-by: Charles Garwood <cgarwood@newdealmultimedia.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
b8918d7d17
commit
2c651e190f
3 changed files with 261 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
import jwt
|
||||
from pyenphase import (
|
||||
Envoy,
|
||||
EnvoyData,
|
||||
|
@ -368,7 +369,10 @@ def mock_authenticate():
|
|||
@pytest.fixture(name="mock_auth")
|
||||
def mock_auth(serial_number):
|
||||
"""Define a mocked EnvoyAuth fixture."""
|
||||
return EnvoyTokenAuth("127.0.0.1", token="abc", envoy_serial=serial_number)
|
||||
token = jwt.encode(
|
||||
payload={"name": "envoy", "exp": 1907837780}, key="secret", algorithm="HS256"
|
||||
)
|
||||
return EnvoyTokenAuth("127.0.0.1", token=token, envoy_serial=serial_number)
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_setup")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue