How to use metadata_lint_update method in molecule

Best Python code snippet using molecule_python

test_scenarios.py

Source:test_scenarios.py Github

copy

Full Screen

...81 'verifier_name': 'inspec',82 }83 cmd = sh.molecule.bake('init', 'role', **options)84 pytest.helpers.run_command(cmd)85 pytest.helpers.metadata_lint_update(role_directory)86 with change_dir_to(role_directory):87 sh.molecule('test')88def test_command_init_scenario_inspec(temp_dir):89 role_directory = os.path.join(temp_dir.strpath, 'test-init')90 options = {91 'role_name': 'test-init',92 }93 cmd = sh.molecule.bake('init', 'role', **options)94 pytest.helpers.run_command(cmd)95 pytest.helpers.metadata_lint_update(role_directory)96 with change_dir_to(role_directory):97 molecule_directory = pytest.helpers.molecule_directory()98 scenario_directory = os.path.join(molecule_directory, 'test-scenario')99 options = {100 'scenario_name': 'test-scenario',101 'role_name': 'test-init',102 'verifier_name': 'inspec',103 }104 cmd = sh.molecule.bake('init', 'scenario', **options)105 pytest.helpers.run_command(cmd)106 assert os.path.isdir(scenario_directory)107def test_command_init_role_goss(temp_dir):108 role_directory = os.path.join(temp_dir.strpath, 'test-init')109 options = {110 'role_name': 'test-init',111 'verifier_name': 'goss',112 }113 cmd = sh.molecule.bake('init', 'role', **options)114 pytest.helpers.run_command(cmd)115 pytest.helpers.metadata_lint_update(role_directory)116 with change_dir_to(role_directory):117 sh.molecule('test')118def test_command_init_scenario_goss(temp_dir):119 role_directory = os.path.join(temp_dir.strpath, 'test-init')120 options = {121 'role_name': 'test-init',122 }123 cmd = sh.molecule.bake('init', 'role', **options)124 pytest.helpers.run_command(cmd)125 pytest.helpers.metadata_lint_update(role_directory)126 with change_dir_to(role_directory):127 molecule_directory = pytest.helpers.molecule_directory()128 scenario_directory = os.path.join(molecule_directory, 'test-scenario')129 options = {130 'scenario_name': 'test-scenario',131 'role_name': 'test-init',132 'verifier_name': 'goss',133 }134 cmd = sh.molecule.bake('init', 'scenario', **options)135 pytest.helpers.run_command(cmd)136 assert os.path.isdir(scenario_directory)137def test_command_init_scenario_with_invalid_role_raises(temp_dir):138 role_directory = os.path.join(temp_dir.strpath, 'test-role')139 options = {140 'role_name': 'test-role',141 }142 cmd = sh.molecule.bake('init', 'role', **options)143 pytest.helpers.run_command(cmd)144 pytest.helpers.metadata_lint_update(role_directory)145 with change_dir_to(role_directory):146 options = {147 'scenario_name': 'default',148 'role_name': 'invalid-role-name',149 }150 with pytest.raises(sh.ErrorReturnCode) as e:151 cmd = sh.molecule.bake('init', 'scenario', **options)152 pytest.helpers.run_command(cmd, log=False)153 msg = ("ERROR: The role 'invalid-role-name' not found. "154 'Please choose the proper role name.')155 assert msg in str(e.value.stderr)156def test_command_init_scenario_as_default_without_default_scenario(temp_dir):157 role_directory = os.path.join(temp_dir.strpath, 'test-role')158 options = {159 'role_name': 'test-role',160 }161 cmd = sh.molecule.bake('init', 'role', **options)162 pytest.helpers.run_command(cmd)163 pytest.helpers.metadata_lint_update(role_directory)164 with change_dir_to(role_directory):165 molecule_directory = pytest.helpers.molecule_directory()166 scenario_directory = os.path.join(molecule_directory, 'default')167 shutil.rmtree(scenario_directory)168 options = {169 'scenario_name': 'default',170 'role_name': 'test-role',171 }172 cmd = sh.molecule.bake('init', 'scenario', **options)173 pytest.helpers.run_command(cmd)174 assert os.path.isdir(scenario_directory)175# NOTE(retr0h): Molecule does not allow the creation of a role without176# a default scenario. This tests roles not created by a newer Molecule.177def test_command_init_scenario_without_default_scenario_raises(temp_dir):178 role_directory = os.path.join(temp_dir.strpath, 'test-role')179 options = {180 'role_name': 'test-role',181 }182 cmd = sh.molecule.bake('init', 'role', **options)183 pytest.helpers.run_command(cmd)184 pytest.helpers.metadata_lint_update(role_directory)185 with change_dir_to(role_directory):186 molecule_directory = pytest.helpers.molecule_directory()187 scenario_directory = os.path.join(molecule_directory, 'default')188 shutil.rmtree(scenario_directory)189 options = {190 'scenario_name': 'invalid-role-name',191 'role_name': 'test-role',192 }193 with pytest.raises(sh.ErrorReturnCode) as e:194 cmd = sh.molecule.bake('init', 'scenario', **options)195 pytest.helpers.run_command(cmd, log=False)196 msg = ('The default scenario not found. Please create a scenario '197 "named 'default' first.")198 assert msg in str(e.value.stderr)199def test_command_init_role_with_template(temp_dir):200 role_name = 'test-init'201 role_directory = os.path.join(temp_dir.strpath, role_name)202 options = {203 'url': 'https://github.com/ansible/molecule-cookiecutter.git',204 'no_input': True,205 'role_name': role_name,206 }207 cmd = sh.molecule.bake('init', 'template', **options)208 pytest.helpers.run_command(cmd)209 pytest.helpers.metadata_lint_update(role_directory)210 with change_dir_to(role_directory):211 sh.molecule('test')212@pytest.mark.parametrize(213 'scenario_to_test, driver_name, scenario_name', [214 ('overrride_driver', 'docker', 'default'),215 ],216 indirect=[217 'scenario_to_test',218 'driver_name',219 'scenario_name',220 ])221def test_command_test_overrides_driver(scenario_to_test, with_scenario,222 driver_name, scenario_name):223 options = {...

Full Screen

Full Screen

test_func.py

Source:test_func.py Github

copy

Full Screen

...31 """Test init scenario with driver."""32 role_directory = os.path.join(temp_dir.strpath, "test-init")33 cmd = ["molecule", "init", "role", "test-init"]34 assert run_command(cmd).returncode == 035 metadata_lint_update(role_directory)36 with change_dir_to(role_directory):37 molecule_directory = pytest.helpers.molecule_directory()38 scenario_directory = os.path.join(molecule_directory, "test-scenario")39 cmd = [40 "molecule",41 "init",42 "scenario",43 "test-scenario",44 "--role-name",45 "test-init",46 "--driver-name",47 driver_name,48 ]49 assert run_command(cmd).returncode == 0...

Full Screen

Full Screen

test_ecs.py

Source:test_ecs.py Github

copy

Full Screen

...31 role_directory = os.path.join(temp_dir.strpath, "test-init")32 options = {}33 cmd = sh.molecule.bake("init", "role", "test-init", **options)34 run_command(cmd)35 metadata_lint_update(role_directory)36 with change_dir_to(role_directory):37 molecule_directory = pytest.helpers.molecule_directory()38 scenario_directory = os.path.join(molecule_directory, "test-scenario")39 options = {40 "role_name": "test-init",41 "driver-name": "ecs",42 }43 cmd = sh.molecule.bake("init", "scenario", "test-scenario", **options)44 run_command(cmd)45 assert os.path.isdir(scenario_directory)46 cmd = sh.molecule.bake("test", "-s", "test-scenario")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run molecule automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful