-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added pragmas not to cover already covered by ha
- Loading branch information
Miloš Ljubenović
committed
Sep 4, 2024
1 parent
96b4946
commit ea9fea5
Showing
8 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from custom_components.catlink.helpers import Helper | ||
|
||
from datetime import timedelta | ||
from homeassistant.core import HomeAssistant | ||
from custom_components.catlink import const | ||
from unittest.mock import MagicMock, AsyncMock | ||
class TestHelper: | ||
|
||
|
||
async def test_calculate_update_interval(self) -> None: | ||
|
||
assert Helper.calculate_update_interval("00:11:00") == timedelta(hours=0, minutes=11, seconds=0) | ||
# test default value | ||
assert Helper.calculate_update_interval(None) == timedelta(minutes=10) | ||
|
||
|
||
async def test_async_setup_accounts(cls, hass: HomeAssistant) -> None: | ||
hass.data = {} | ||
mocked_coordinator = MagicMock() | ||
mocked_coordinator.update_hass_entities = AsyncMock() | ||
mocked_coordinator.data = MagicMock(return_value={}) | ||
hass.data[const.DOMAIN] = { | ||
'coordinators': { | ||
'coordinator_1': mocked_coordinator | ||
} | ||
} | ||
assert Helper.async_setup_accounts(hass, {}) |