def git_tag_test(self): """Test creating an archive from a git tag""" git_repo = toml.loads(""" [[repos.git]] rpmname="git-rpm-test" rpmversion="1.0.0" rpmrelease="1" summary="Testing the git rpm code" repo="file://%s" ref="v1.1.0" destination="/srv/testing-rpm/" """ % (self.repodir)) archive = GitArchiveTarball(git_repo["repos"]["git"][0]) self._check_tar(archive, "git-rpm-test/", "second")
def git_branch_test(self): """Test creating an archive from a git branch""" git_repo = toml.loads(""" [[repos.git]] rpmname="git-rpm-test" rpmversion="1.0.0" rpmrelease="1" summary="Testing the git rpm code" repo="file://%s" ref="origin/custom-branch" destination="/srv/testing-rpm/" """ % self.repodir) archive = GitArchiveTarball(git_repo["repos"]["git"][0]) self._check_tar(archive, "git-rpm-test/", "branch")
def test_git_commit(self): """Test creating an archive from a git commit hash""" git_repo = toml.loads(""" [[repos.git]] rpmname="git-rpm-test" rpmversion="1.0.0" rpmrelease="1" summary="Testing the git rpm code" repo="file://%s" ref="%s" destination="/srv/testing-rpm/" """ % (self.repodir, self.first_commit)) archive = GitArchiveTarball(git_repo["repos"]["git"][0]) self._check_tar(archive, "git-rpm-test/", "first")
def git_fail_ref_test(self): """Test creating an archive from a bad ref""" git_repo = toml.loads(""" [[repos.git]] rpmname="git-rpm-test" rpmversion="1.0.0" rpmrelease="1" summary="Testing the git rpm code" repo="file://%s" ref="0297617d7b8baa263a69ae7dc901bbbcefd0eaa4" destination="/srv/testing-rpm/" """ % (self.repodir)) with self.assertRaises(RuntimeError): archive = GitArchiveTarball(git_repo["repos"]["git"][0]) self._check_tar(archive, "git-rpm-test/", None)
def git_fail_repo_test(self): """Test creating an archive from a bad url""" git_repo = toml.loads(""" [[repos.git]] rpmname="git-rpm-test" rpmversion="1.0.0" rpmrelease="1" summary="Testing the git rpm code" repo="file://%s" ref="v1.1.0" destination="/srv/testing-rpm/" """ % ("/tmp/no-repo-here/")) with self.assertRaises(RuntimeError): archive = GitArchiveTarball(git_repo["repos"]["git"][0]) self._check_tar(archive, "git-rpm-test/", None)