async def test_change_light_state( sut: LightController, mocker: MockerFixture, old: int, attribute: str, direction: Literal["up", "down"], stepper: MinMaxStepper, smooth_power_on_check: bool, stop_expected: bool, expected_value_attribute: int, ): called_service_patch = mocker.patch.object(sut, "call_service") sut.value_attribute = old sut.smooth_power_on_check = smooth_power_on_check sut.remove_transition_check = False sut.manual_steppers = {attribute: stepper} sut.automatic_steppers = {attribute: stepper} sut.feature_support._supported_features = 0 stop = await sut.change_light_state(old, attribute, direction, stepper, "hold") assert stop == stop_expected assert sut.value_attribute == expected_value_attribute called_service_patch.assert_called()
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)