Exclude access token from host info updates in Konnected config flow (#33912)

* black updates

* test that host update doesn't impact access token
This commit is contained in:
Kit Klein authored and Paulus Schoutsen committed 2020-04-09 17:20:21 -07:00
1 parent e0595ce518
commit 3ad9052b5c
2 files changed
+10 -9

No files matched your search

@@ -362,10 +362,11 @@ async def test_ssdp_host_update(hass, mock_panel):
)
assert result["type"] == "abort"
# confirm the host value was updated
# confirm the host value was updated, access_token was not
entry = hass.config_entries.async_entries(config_flow.DOMAIN)[0]
assert entry.data["host"] == "1.1.1.1"
assert entry.data["port"] == 1234
assert entry.data["access_token"] == "11223344556677889900"
async def test_import_existing_config(hass, mock_panel):
@@ -494,6 +495,7 @@ async def test_import_existing_config_entry(hass, mock_panel):
data={
"host": "0.0.0.0",
"port": 1111,
"access_token": "ORIGINALTOKEN",
"id": "112233445566",
"extra": "something",
},
@@ -546,14 +548,14 @@ async def test_import_existing_config_entry(hass, mock_panel):
assert result["type"] == "abort"
# We should have updated the entry
# We should have updated the host info but not the access token
assert len(hass.config_entries.async_entries("konnected")) == 1
assert hass.config_entries.async_entries("konnected")[0].data == {
"host": "1.2.3.4",
"port": 1234,
"access_token": "ORIGINALTOKEN",
"id": "112233445566",
"model": "Konnected Pro",
"access_token": "SUPERSECRETTOKEN",
"extra": "something",
}