Set unique id on homekit_controller config entries (#30035)

* Set unique id on config entries

* Changes from review
This commit is contained in:
Jc2k authored and Paulus Schoutsen committed 2019-12-19 09:45:22 +01:00
1 parent 9e5de1a106
commit c3144eddbb
3 files changed
+55 -36

No files matched your search

@@ -74,6 +74,7 @@ async def test_discovery_works(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device enters pairing mode and displays code
@@ -122,6 +123,7 @@ async def test_discovery_works_upper_case(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device enters pairing mode and displays code
@@ -169,6 +171,7 @@ async def test_discovery_works_missing_csharp(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device enters pairing mode and displays code
@@ -234,6 +237,7 @@ async def test_pair_already_paired_1(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -259,6 +263,7 @@ async def test_discovery_ignored_model(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -286,6 +291,7 @@ async def test_discovery_invalid_config_entry(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# Discovery of a HKID that is in a pairable state but for which there is
@@ -315,10 +321,7 @@ async def test_discovery_already_configured(hass):
result = await flow.async_step_zeroconf(discovery_info)
assert result["type"] == "abort"
assert result["reason"] == "already_configured"
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
}
assert flow.context == {}
assert conn.async_config_num_changed.call_count == 0
@@ -343,10 +346,7 @@ async def test_discovery_already_configured_config_change(hass):
result = await flow.async_step_zeroconf(discovery_info)
assert result["type"] == "abort"
assert result["reason"] == "already_configured"
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
}
assert flow.context == {}
assert conn.async_refresh_entity_map.call_args == mock.call(2)
@@ -369,6 +369,7 @@ async def test_pair_unable_to_pair(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device enters pairing mode and displays code
@@ -402,6 +403,7 @@ async def test_pair_abort_errors_on_start(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device refuses to enter pairing mode
@@ -414,6 +416,7 @@ async def test_pair_abort_errors_on_start(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -436,6 +439,7 @@ async def test_pair_form_errors_on_start(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device refuses to enter pairing mode
@@ -448,6 +452,7 @@ async def test_pair_form_errors_on_start(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -470,6 +475,7 @@ async def test_pair_abort_errors_on_finish(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device enters pairing mode and displays code
@@ -486,6 +492,7 @@ async def test_pair_abort_errors_on_finish(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -508,6 +515,7 @@ async def test_pair_form_errors_on_finish(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
# User initiates pairing - device enters pairing mode and displays code
@@ -524,6 +532,7 @@ async def test_pair_form_errors_on_finish(hass, exception, expected):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -712,6 +721,7 @@ async def test_parse_new_homekit_json(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -763,6 +773,7 @@ async def test_parse_old_homekit_json(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}
@@ -823,4 +834,5 @@ async def test_parse_overlapping_homekit_json(hass):
assert flow.context == {
"hkid": "00:00:00:00:00:00",
"title_placeholders": {"name": "TestDevice"},
"unique_id": "00:00:00:00:00:00",
}