def mock_service(hass, domain, service):
    calls = []

    hass.services.register(
        domain, service, lambda call: calls.append(call))

    return calls
Setup a fake service.
dataset/ETHPy150Open home-assistant/home-assistant/tests/common.py/mock_service