def test_generate_cot(artifacts, context): path = os.path.join(context.config['work_dir'], "foo") signed_body = cot.generate_cot(context, path=path) with open(path, "r") as fh: assert fh.read() == signed_body body = sgpg.get_body(sgpg.GPG(context), signed_body) log.info(body) assert body.rstrip() == cot.format_json(cot.generate_cot_body(context))
def test_generate_cot_unsigned(artifacts, context): context.config['sign_chain_of_trust'] = False path = os.path.join(context.config['work_dir'], "foo") body = cot.generate_cot(context, path=path) assert body == cot.format_json(cot.generate_cot_body(context))
def test_generate_cot_body_exception(artifacts, context): del context.config['worker_type'] with pytest.raises(ScriptWorkerException): cot.generate_cot_body(context)
def test_generate_cot_body(artifacts, context): assert cot.generate_cot_body(context) == expected_cot_body( context, artifacts)
def test_generate_cot_unsigned(artifacts, context): context.config["sign_chain_of_trust"] = False body = cot.generate_cot(context, parent_path=context.config["work_dir"]) assert body == cot.format_json(cot.generate_cot_body(context))
def test_generate_cot_unsigned(artifacts, context): context.config['sign_chain_of_trust'] = False body = cot.generate_cot(context, parent_path=context.config['work_dir']) assert body == cot.format_json(cot.generate_cot_body(context))
def test_generate_cot_body(artifacts, context): assert cot.generate_cot_body(context) == expected_cot_body(context, artifacts)