async def test_setup_service_call_interceptor(hass):
    """Test setup and removal of service call interceptor."""
    service_func_mock = AsyncMock()
    hass.services.async_register(LIGHT_DOMAIN, SERVICE_TURN_ON, service_func_mock)

    async def service_call():
        await hass.services.async_call(
            LIGHT_DOMAIN,
            SERVICE_TURN_ON,
            {},
            blocking=True,
        )

    # Test if service is called

    await service_call()
    assert service_func_mock.call_count == 1

    # Test if interceptor is called after setup

    intercept_func_mock = AsyncMock()
    remove_interceptor = setup_service_call_interceptor(
        hass,
        LIGHT_DOMAIN,
        SERVICE_TURN_ON,
        intercept_func_mock,
    )

    await service_call()
    assert service_func_mock.call_count == 2
    assert intercept_func_mock.call_count == 1

    # Test if interceptor is no longer called after removal

    remove_interceptor()
    await service_call()
    assert service_func_mock.call_count == 3
    assert intercept_func_mock.call_count == 1
Test setup and removal of service call interceptor.
tests/test_hass_utils.py