'Test include dir merge named yaml.'

@patch('homeassistant.util.yaml.os.walk')
def test_include_dir_merge_named_recursive(self, mock_walk):

    mock_walk.return_value = [['/tmp', ['tmp2', '.ignore', 'ignore'], ['first.yaml']], ['/tmp/tmp2', [], ['second.yaml', 'third.yaml']], ['/tmp/ignore', [], ['.ignore.yaml']]]
    with patch_yaml_files({'/tmp/first.yaml': 'key1:    one', '/tmp/tmp2/second.yaml': 'key2:    two', '/tmp/tmp2/third.yaml': 'key3:    three\nkey4:    four'}):
        conf = 'key:    !include_dir_merge_named    /tmp'
        with io.StringIO(conf) as file:
            assert ('.ignore' in mock_walk.return_value[0][1]), 'Expecting    .ignore    in    here'
            doc = yaml.yaml.safe_load(file)
            assert ('tmp2' in mock_walk.return_value[0][1])
            assert ('.ignore' not in mock_walk.return_value[0][1])
            assert (doc['key'] == {'key1': 'one', 'key2': 'two', 'key3': 'three', 'key4': 'four'})
