def test_create_clones_repo(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD") uut.create() assert exists(join(self.checkouts_dir, "-project-", "checkout", ".git"))
def test_create_copies_and_checks_out_repo(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD") uut.create() expected_checkout_path = join(self.checkouts_dir, "-project-", "-id-", "checkout") assert_equals(expected_checkout_path, uut.checkout_dir) assert exists(join(expected_checkout_path, ".git"))
def test_delete(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD") uut.create() uut.delete() assert not exists(join(self.checkouts_dir, "-project-", "checkout")) assert not exists(uut.checkout_dir)
def get_checkout(self, base_path: str) -> ProjectCheckout: repository = self.__project.repository if repository.vcstype == "git": url = repository.url return GitProjectCheckout(url, base_path, self.__project.id, self.version_id, self.revision) elif repository.vcstype == "svn": url = repository.url return SVNProjectCheckout(url, base_path, self.__project.id, self.version_id, self.revision) elif repository.vcstype == "synthetic": return SyntheticProjectCheckout(base_path, self.__project.id, self.version_id) elif repository.vcstype == "zip": return ZipProjectCheckout(self.revision, self._yaml["md5"], base_path, self.__project.id, self.version_id) else: raise ValueError("unknown repository type: {}".format(repository.vcstype))
def test_to_string(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "-revision-") assert_equals("git:{}#-revisio".format(self.git_url), str(uut))
def test_not_exists_broken(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD") os.makedirs(join(uut.checkout_dir, ".git")) assert not uut.exists()
def test_exists(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD") copy_tree(self.git_url, uut.checkout_dir) assert uut.exists()
def test_not_exists(self): uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD") assert not uut.exists()