Exemplo n.º 1
0
 def setUpClass(cls):
     util.setup_http(
         cls=cls,
         loop=loop,
         routes=[
             ("GET", "/foo_bar", util.http_write_handler(cls.foo_bar))
         ],
     )
Exemplo n.º 2
0
    def setUpClass(cls):
        # Dummy git origin
        cls.origin_git_cls = util.TemporaryGitDirectory()
        cls.origin_git = cls.origin_git_cls.__enter__()

        with open(os.path.join(cls.origin_git, "asd.txt"), "w") as f:
            f.write("Origin")

        util.quiet_check_call(["git", "-C", cls.origin_git, "add", "-A"])
        util.quiet_check_call(["git", "-C", cls.origin_git, "commit", "-m", "Some origin commit"])

        cls.origin_git = "file://" + cls.origin_git

        # Dummy archive origin
        tar_buf = io.BytesIO()
        with tarfile.open(fileobj=tar_buf, mode="w:xz") as t:
            i = tarfile.TarInfo("asd.txt")

            b = io.BytesIO(b"Hello\n")
            b.seek(0, io.SEEK_END)
            i.size = b.tell()
            b.seek(0)

            t.addfile(i, b)

        # Dummy archive origin (with single root dir)
        srd_tar_buf = io.BytesIO()
        with tarfile.open(fileobj=srd_tar_buf, mode="w:xz") as t:
            i = tarfile.TarInfo("srd/asd.txt")

            b = io.BytesIO(b"Hello\n")
            b.seek(0, io.SEEK_END)
            i.size = b.tell()
            b.seek(0)

            t.addfile(i, b)

        util.setup_http(
            cls=cls,
            loop=loop,
            routes=[
                ("GET", "/test.tar.xz", util.http_write_handler(tar_buf)),
                ("GET", "/srd_test.tar.xz", util.http_write_handler(srd_tar_buf)),
            ],
        )
Exemplo n.º 3
0
 def setUpClass(cls):
     util.setup_http(
         cls=cls,
         loop=loop,
         routes=[("GET", "/foo_bar", util.http_write_handler(cls.foo_bar))],
     )