Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AppDaemon command. #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions appdaemontestframework/hass_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def _hass_init_mock(self, _ad, name, *_args):
MockHandler(Hass, 'turn_on'),
MockHandler(Hass, 'turn_off'),
MockHandler(Hass, 'fire_event'),
MockHandler(Hass, 'select_option'),

### Custom callback functions
MockHandler(Hass, 'register_constraint'),
Expand Down
7 changes: 7 additions & 0 deletions test/test_extra_hass_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def call_notify(self):
def call_now_is_between(self):
self.now_is_between("sunset - 00:45:00", "sunrise + 00:45:00")

def call_select_option(self):
self.select_option("select_item", "value")


@automation_fixture(WithExtraHassFunctions)
def with_extra_hass_functions():
Expand All @@ -27,3 +30,7 @@ def test_now_is_between(given_that, with_extra_hass_functions, hass_mocks):
def test_notify(given_that, with_extra_hass_functions, hass_mocks):
with_extra_hass_functions.call_notify()
hass_mocks.hass_functions['notify'].assert_called_with(message="test", name="html5")

def test_select_option(given_that, with_extra_hass_functions, hass_mocks):
with_extra_hass_functions.call_select_option()
hass_mocks.hass_functions['select_option'].assert_called_with("select_item", "value")