Add work items per type and state counter sensors to Azure DevOps (#119737)

* Add work item data

* Add work item sensors

* Add icon

* Add test fixtures

* Add none return tests

* Apply suggestions from code review

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Apply suggestion

* Use icon translations

* Apply suggestions from code review

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update test

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Aidan Timson
2024-08-30 15:45:46 +01:00
committed by GitHub
parent 240bd6c3bf
commit 1d05a917f9
8 changed files with 253 additions and 7 deletions

View File

@@ -91,3 +91,48 @@ async def test_no_builds(
assert mock_devops_client.get_builds.call_count == 1
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
async def test_no_work_item_types(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
mock_devops_client: MagicMock,
) -> None:
"""Test a failed update entry."""
mock_devops_client.get_work_item_types.return_value = None
await setup_integration(hass, mock_config_entry)
assert mock_devops_client.get_work_item_types.call_count == 1
assert mock_config_entry.state is ConfigEntryState.LOADED
async def test_no_work_item_ids(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
mock_devops_client: MagicMock,
) -> None:
"""Test a failed update entry."""
mock_devops_client.get_work_item_ids.return_value = None
await setup_integration(hass, mock_config_entry)
assert mock_devops_client.get_work_item_ids.call_count == 1
assert mock_config_entry.state is ConfigEntryState.LOADED
async def test_no_work_items(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
mock_devops_client: MagicMock,
) -> None:
"""Test a failed update entry."""
mock_devops_client.get_work_items.return_value = None
await setup_integration(hass, mock_config_entry)
assert mock_devops_client.get_work_items.call_count == 1
assert mock_config_entry.state is ConfigEntryState.LOADED