def test_process_dockerfile(self, tmpdir): """ """ input = tmpdir.join("Dockerfile.jinja") input.write("{{ barfoo }}") o = tmpdir.join("Dockerfile") c = tmpdir.join("conf.json") c.write('{"env": {"barfoo": "foobar"}}') c = Core({ "--dockerfile": str(input), "--outfile": str(o), "--config": str(c), }) c.load_user_specefied_config_file() c.parse_env_vars() c.handle_data_sources() c.process_dockerfile() assert o.read() == "foobar"
def test_process_dockerfile_no_output_file_specefied(self, tmpdir): """ Found a bug that if no --outfile is specefied it will not work and throw exception that it should not do... """ input = tmpdir.join("Dockerfile.jinja") input.write("{{ barfoo }}") c = tmpdir.join("conf.json") c.write('{"env": {"barfoo": "foobar"}}') c = Core({ "--dockerfile": str(input), "--config": str(c), }) with pytest.raises(Exception) as ex: c.load_user_specefied_config_file() c.parse_env_vars() c.handle_data_sources() c.process_dockerfile() assert str(ex.value).startswith("missing key '--outfile' in cli_args. Could not write to output file.")
def test_process_dockerfile_no_output_file_specefied(self, tmpdir): """ Found a bug that if no --outfile is specefied it will not work and throw exception that it should not do... """ input = tmpdir.join("Dockerfile.jinja") input.write("{{ barfoo }}") c = tmpdir.join("conf.json") c.write('{"env": {"barfoo": "foobar"}}') c = Core({ "--dockerfile": str(input), "--config": str(c), }) with pytest.raises(Exception) as ex: c.load_user_specefied_config_file() c.parse_env_vars() c.handle_data_sources() c.process_dockerfile() assert str(ex.value).startswith( "missing key '--outfile' in cli_args. Could not write to output file." )