'Test the calling of a service.'

def test_calling_service_template(self):

    calls = []
    @callback
    def record_call(service):
        'Add    recorded    event    to    set.'
        calls.append(service)
    self.hass.services.register('test', 'script', record_call)
    script.call_from_config(self.hass, {'service_template': '\n                                                                {%    if    True    %}\n                                                                                test.script\n                                                                {%    else    %}\n                                                                                test.not_script\n                                                                {%    endif    %}', 'data_template': {'hello': '\n                                                                                {%    if    True    %}\n                                                                                                world\n                                                                                {%    else    %}\n                                                                                                Not    world\n                                                                                {%    endif    %}\n                                                                '}})
    self.hass.block_till_done()
    assert (len(calls) == 1)
    assert (calls[0].data.get('hello') == 'world')
