Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_config_private_member(_instance):
assert isinstance(_instance._config, config.Config)
def test_config_private_member(_instance):
assert isinstance(_instance._config, config.Config)
def molecule_instance(temp_files, molecule_args):
c = temp_files(fixtures=['molecule_vagrant_config'])
m = core.Molecule(molecule_args)
m.config = config.Config(configs=c)
m.main()
return m
def test_linode_config_gives_config_object(linode_instance):
assert isinstance(linode_instance._config, config.Config)
def test_configs_private_member(_instance):
assert 2 == len(_instance._configs)
assert isinstance(_instance._configs[0], config.Config)
assert isinstance(_instance._configs[1], config.Config)
def test_config_private_member(ansible_instance):
assert isinstance(ansible_instance._config, config.Config)
def test_config_private_member(_instance):
assert isinstance(_instance._config, config.Config)
def test_get_data_loads_existing_state_file(temp_dir, molecule_data):
molecule_directory = config.molecule_directory(temp_dir.strpath)
scenario_directory = os.path.join(molecule_directory, 'default')
molecule_file = config.molecule_file(scenario_directory)
ephemeral_directory = config.molecule_ephemeral_directory(
scenario_directory)
state_file = os.path.join(ephemeral_directory, 'state.yml')
os.makedirs(ephemeral_directory)
data = {'converged': False, 'created': True, 'driver': None}
util.write_file(state_file, util.safe_dump(data))
pytest.helpers.write_molecule_file(molecule_file, molecule_data)
c = config.Config(molecule_file)
s = state.State(c)
assert not s.converged
assert s.created
assert not s.driver
def _get_config(self):
molecule_file = os.environ['MOLECULE_FILE']
return molecule.config.Config(molecule_file)
def get_configs(args, command_args, ansible_args=()):
"""
Glob the current directory for Molecule config files, instantiate config
objects, and returns a list.
:param args: A dict of options, arguments and commands from the CLI.
:param command_args: A dict of options passed to the subcommand from
the CLI.
:param ansible_args: An optional tuple of arguments provided to the
`ansible-playbook` command.
:return: list
"""
configs = [
config.Config(
molecule_file=util.abs_path(c),
args=args,
command_args=command_args,
ansible_args=ansible_args,
)
for c in glob.glob(MOLECULE_GLOB)
]
_verify_configs(configs)
return configs