async def test_hls_stream(hass, hass_client, stream_worker_sync):
    '\n    Test hls stream.\n\n    Purposefully not mocking anything here to test full\n    integration with the stream component.\n    '
    (await async_setup_component(hass, 'stream', {'stream': {}}))
    stream_worker_sync.pause()
    source = generate_h264_video()
    stream = preload_stream(hass, source)
    stream.add_provider('hls')
    url = request_stream(hass, source)
    http_client = (await hass_client())
    parsed_url = urlparse(url)
    playlist_response = (await http_client.get(parsed_url.path))
    assert (playlist_response.status == 200)
    playlist = (await playlist_response.text())
    playlist_url = '/'.join(parsed_url.path.split('/')[:(- 1)])
    init_url = (playlist_url + '/init.mp4')
    init_response = (await http_client.get(init_url))
    assert (init_response.status == 200)
    playlist = (await playlist_response.text())
    playlist_url = '/'.join(parsed_url.path.split('/')[:(- 1)])
    segment_url = ((playlist_url + '/') + playlist.splitlines()[(- 1)])
    segment_response = (await http_client.get(segment_url))
    assert (segment_response.status == 200)
    stream_worker_sync.resume()
    stream.stop()
    fail_response = (await http_client.get(parsed_url.path))
    assert (fail_response.status == HTTP_NOT_FOUND)
Test hls stream.

Purposefully not mocking anything here to test full
integration with the stream component.
async def test_hls_stream(hass, hass_client, stream_worker_sync):
    '\n    Test hls stream.\n\n    Purposefully not mocking anything here to test full\n    integration with the stream component.\n    '
    (await async_setup_component(hass, 'stream', {'stream': {}}))
    stream_worker_sync.pause()
    source = generate_h264_video()
    stream = preload_stream(hass, source)
    stream.add_provider('hls')
    url = request_stream(hass, source)
    http_client = (await hass_client())
    parsed_url = urlparse(url)
    playlist_response = (await http_client.get(parsed_url.path))
    assert (playlist_response.status == 200)
    playlist = (await playlist_response.text())
    playlist_url = '/'.join(parsed_url.path.split('/')[:(- 1)])
    init_url = (playlist_url + '/init.mp4')
    init_response = (await http_client.get(init_url))
    assert (init_response.status == 200)
    playlist = (await playlist_response.text())
    playlist_url = '/'.join(parsed_url.path.split('/')[:(- 1)])
    segment_url = ((playlist_url + '/') + playlist.splitlines()[(- 1)])
    segment_response = (await http_client.get(segment_url))
    assert (segment_response.status == 200)
    stream_worker_sync.resume()
    stream.stop()
    fail_response = (await http_client.get(parsed_url.path))
    assert (fail_response.status == HTTP_NOT_FOUND)