import yaml


def valid_config_file(tmpdir, faker):
    """produce a valid config file using a fake dictionary

    Returns:
        tuple -- Tuple containing following:
                    1. Path to a valid config file
                    2. Random dictionary used to generate the config file
    """

    cfg = tmpdir.join('valid-config.yaml')
    fakedict = faker.pydict(10, True, str, int)
    fakeyaml = yaml.dump(fakedict, default_flow_style=False)
    cfg.write(fakeyaml)

    return (cfg, fakedict)