Complete device registry update (#34500)

* Add manufacturer and model parameters to device registry update
  method.
pull/34509/head
Martin Hjelmare 2020-04-21 19:40:16 +02:00 committed by GitHub
parent 220baed33a
commit fbde040f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -152,6 +152,8 @@ class DeviceRegistry:
device_id,
*,
area_id=_UNDEF,
manufacturer=_UNDEF,
model=_UNDEF,
name=_UNDEF,
name_by_user=_UNDEF,
new_identifiers=_UNDEF,
@ -163,6 +165,8 @@ class DeviceRegistry:
return self._async_update_device(
device_id,
area_id=area_id,
manufacturer=manufacturer,
model=model,
name=name,
name_by_user=name_by_user,
new_identifiers=new_identifiers,

View File

@ -397,6 +397,8 @@ async def test_update(registry):
updated_entry = registry.async_update_device(
entry.id,
area_id="12345A",
manufacturer="Test Producer",
model="Test Model",
name_by_user="Test Friendly Name",
new_identifiers=new_identifiers,
via_device_id="98765B",
@ -405,6 +407,8 @@ async def test_update(registry):
assert mock_save.call_count == 1
assert updated_entry != entry
assert updated_entry.area_id == "12345A"
assert updated_entry.manufacturer == "Test Producer"
assert updated_entry.model == "Test Model"
assert updated_entry.name_by_user == "Test Friendly Name"
assert updated_entry.identifiers == new_identifiers
assert updated_entry.via_device_id == "98765B"