'Setup demo platform with cache and call service without cache.'

def test_setup_component_test_with_cache_dir(self):

    calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
    (_, demo_data) = self.demo_provider.get_tts_audio('bla', 'en')
    cache_file = os.path.join(self.default_tts_cache, '265944c108cbb00b2a621be5930513e03a0bb2cd_en_-_demo.mp3')
    os.mkdir(self.default_tts_cache)
    with open(cache_file, 'wb') as voice_file:
        voice_file.write(demo_data)
    config = {tts.DOMAIN: {'platform': 'demo', 'cache': True}}
    with assert_setup_component(1, tts.DOMAIN):
        setup_component(self.hass, tts.DOMAIN, config)
    with patch('homeassistant.components.tts.demo.DemoProvider.get_tts_audio', return_value=(None, None)):
        self.hass.services.call(tts.DOMAIN, 'demo_say', {tts.ATTR_MESSAGE: 'I    person    is    on    front    of    your    door.'})
    self.hass.block_till_done()
    assert (len(calls) == 1)
    assert (calls[0].data[ATTR_MEDIA_CONTENT_ID].find('/api/tts_proxy/265944c108cbb00b2a621be5930513e03a0bb2cd_en_-_demo.mp3') != (-1))
