def test_050_gen_repo_files_g(self): repo = mk_remote_repo() ctx = mk_ctx([repo]) workdir = ctx["workdir"] files = list(TT.gen_repo_files_g(repo, ctx, workdir, C.template_paths())) self.assertTrue(files) self.assertEquals(files[0][0], os.path.join(workdir, "fedora-yumrepos.repo")) self.assertEquals(files[-1][0], os.path.join(workdir, "fedora-yumrepos-19.spec"))
def test_100_prepare(self): repo = mk_remote_repo() ctx = mk_ctx([repo]) files = list(TT.gen_repo_files_g(repo, ctx, ctx["workdir"], C.template_paths())) gmcs = TT.gen_mockcfg_files_cmd_g(repo, ctx, ctx["workdir"], C.template_paths()) rcs = ["mkdir -p " + ctx["workdir"]] + \ [TT.mk_write_file_cmd(p, c) for p, c in files] + \ list(gmcs) + \ [TT.mk_build_srpm_cmd(files[-1][0], False)] expected = " && ".join(rcs) s = TT.prepare_0(repo, ctx)[0] # Normalize 'EOF_....' lines: expected = re.sub(r"EOF_\S+", "EOF", expected) s = re.sub(r"EOF_\S+", "EOF", s) self.assertEquals(s, expected, C.diff(expected, s))