async def test_call_light_service( sut: LightController, mocker: MockerFixture, attributes_input: Dict[str, str], remove_transition_check: bool, attributes_expected: Dict[str, str], ): called_service_patch = mocker.patch.object(sut, "call_service") sut.transition = 300 sut.remove_transition_check = remove_transition_check await sut.call_light_service("test_service", **attributes_input) called_service_patch.assert_called_once_with("test_service", entity_id=ENTITY_NAME, **attributes_expected)
async def test_check_remove_transition( sut: LightController, add_transition: bool, add_transition_turn_toggle: bool, on_from_user: bool, transition_support: bool, expected_remove_transition_check: bool, ): sut.transition = 300 sut.add_transition = add_transition sut.add_transition_turn_toggle = add_transition_turn_toggle sut.feature_support._supported_features = (LightSupport.TRANSITION if transition_support else 0) output = await sut.check_remove_transition(on_from_user) assert output == expected_remove_transition_check
async def test_call_light_service( sut: LightController, mocker: MockerFixture, attributes_input: Dict[str, str], transition_support: bool, turned_toggle: bool, add_transition: bool, add_transition_turn_toggle: bool, attributes_expected: Dict[str, str], ): called_service_patch = mocker.patch.object(sut, "call_service") sut.transition = 300 sut.add_transition = add_transition sut.add_transition_turn_toggle = add_transition_turn_toggle sut.feature_support._supported_features = ( LightSupport.TRANSITION if transition_support else 0 ) await sut.call_light_service( "test_service", turned_toggle=turned_toggle, **attributes_input ) called_service_patch.assert_called_once_with( "test_service", entity_id=ENTITY_NAME, **attributes_expected )