Rympro integration code fixes (#86734)

* Address review comments

* Add coordinator.py to coveragerc

* Apply suggestions from code review

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Update homeassistant/components/rympro/coordinator.py

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Move SCAN_INTERVAL to coordinator.py

---------

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
This commit is contained in:
On Freund 2023-01-31 11:40:43 +02:00 committed by GitHub
parent a28e7e1541
commit 35b82db8b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 87 additions and 51 deletions

View file

@ -96,6 +96,30 @@ async def test_login_error(hass, exception, error):
assert result2["type"] == FlowResultType.FORM
assert result2["errors"] == {"base": error}
with patch(
"homeassistant.components.rympro.config_flow.RymPro.login",
return_value="test-token",
), patch(
"homeassistant.components.rympro.config_flow.RymPro.account_info",
return_value={"accountNumber": TEST_DATA[CONF_UNIQUE_ID]},
), patch(
"homeassistant.components.rympro.async_setup_entry",
return_value=True,
) as mock_setup_entry:
result3 = await hass.config_entries.flow.async_configure(
result2["flow_id"],
{
CONF_EMAIL: TEST_DATA[CONF_EMAIL],
CONF_PASSWORD: TEST_DATA[CONF_PASSWORD],
},
)
await hass.async_block_till_done()
assert result3["type"] == FlowResultType.CREATE_ENTRY
assert result3["title"] == TEST_DATA[CONF_EMAIL]
assert result3["data"] == TEST_DATA
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_already_exists(hass, _config_entry):
"""Test that a flow with an existing account aborts."""