示例#1
0
 def test_unpackGit(self):
     if not git.isGitInstalled():
         self.fail(
             "Git is not installed on your system.  All Git tests will fail."
         )
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createGitRepository(tempDir)
         pci = createPythonCallInfo(repoPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath,
                                     mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True,
                          "Git repository failed to fetch.")
         self.assertEqual(
             os.path.exists(testFilePath), True,
             "'" + mdTestUtilities.testFileName +
             "' did not exist after fetching a Git repository.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True,
                          "Git repository failed to unpack.")
         self.assertEqual(
             os.path.isdir(pci.currentPath), True,
             "Git repository was not a directory after unpacking.")
         self.assertEqual(
             os.path.exists(
                 os.path.join(pci.currentPath,
                              mdTestUtilities.testFileName)), True,
             "testFile did not exist after unpacking.")
     finally:
         utilityFunctions.removeDir(tempDir)
示例#2
0
    def test_isGitRepoCase2(self):
        #Case 2: URL that is a git repository
        if not git.isGitInstalled():
            self.fail("Git is not installed on your system.  All Git tests will fail.")

        path = "http://github.com/tepperly/MixDown.git"
        self.assertTrue(git.isGitRepo(path), "git.isGitRepo(" + path + ") should have returned true.")
        #Test if wrong path returns false
        falsePath = "http://foo/wrong/path"
        returnValue = git.isGitRepo(falsePath)
        self.assertEqual(returnValue, False, "git.isGitRepo(" + falsePath + ") should have returned false.")
示例#3
0
 def test_gitCheckout(self):
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         git.gitCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(os.path.join(checkedOutRepo, mdTestUtilities.testFileName))
         self.assertEqual(returnValue, True, "'" + mdTestUtilities.testFileName + "' did not exist after git.gitCheckout(" + tempRepo + ") was called.")
     finally:
         utilityFunctions.removeDir(tempDir)
示例#4
0
 def test_fetchGit(self):
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createGitRepository(tempDir)
         pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True, "Hg repository failed to fetch.")
         self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Git repository.")
     finally:
         utilityFunctions.removeDir(tempDir)
示例#5
0
 def test_isGitRepoCase1(self):
     #Case 1: Local directory that is a git repository
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     #Create repository and test if is git repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     try:
         self.assertTrue(git.isGitRepo(tempRepo), "git.isGitRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(git.isGitRepo(falsePath), "git.isGitRepo(" + falsePath + ") should have returned false.")
示例#6
0
    def test_isGitRepoCase4(self):
        #Case 4: Check for false positive with .gz files
        if not git.isGitInstalled():
            self.fail("Git is not installed on your system.  All Git tests will fail.")

        #Local file
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, path = mdTestUtilities.createGzipFile(tempDir)
            self.assertFalse(git.isGitRepo(path), "git.isGitRepo(" + path + ") should have returned false.")
        finally:
            utilityFunctions.removeDir(tempDir)

        #Remote file
        path = "http://www.eng.lsu.edu/mirrors/apache//apr/apr-util-1.3.10.tar.gz"
        self.assertFalse(git.isGitRepo(path), "git.isGitRepo(" + path + ") should have returned false.")
示例#7
0
    def test_isGitRepoCase2(self):
        #Case 2: URL that is a git repository
        if not git.isGitInstalled():
            self.fail(
                "Git is not installed on your system.  All Git tests will fail."
            )

        path = "http://github.com/tepperly/MixDown.git"
        self.assertTrue(
            git.isGitRepo(path),
            "git.isGitRepo(" + path + ") should have returned true.")
        #Test if wrong path returns false
        falsePath = "http://foo/wrong/path"
        returnValue = git.isGitRepo(falsePath)
        self.assertEqual(
            returnValue, False,
            "git.isGitRepo(" + falsePath + ") should have returned false.")
示例#8
0
 def test_gitCheckout(self):
     if not git.isGitInstalled():
         self.fail(
             "Git is not installed on your system.  All Git tests will fail."
         )
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         git.gitCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(
             os.path.join(checkedOutRepo, mdTestUtilities.testFileName))
         self.assertEqual(
             returnValue, True, "'" + mdTestUtilities.testFileName +
             "' did not exist after git.gitCheckout(" + tempRepo +
             ") was called.")
     finally:
         utilityFunctions.removeDir(tempDir)
示例#9
0
 def test_isGitRepoCase1(self):
     #Case 1: Local directory that is a git repository
     if not git.isGitInstalled():
         self.fail(
             "Git is not installed on your system.  All Git tests will fail."
         )
     #Create repository and test if is git repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     try:
         self.assertTrue(
             git.isGitRepo(tempRepo),
             "git.isGitRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(
         git.isGitRepo(falsePath),
         "git.isGitRepo(" + falsePath + ") should have returned false.")
示例#10
0
    def test_isGitRepoCase4(self):
        #Case 4: Check for false positive with .gz files
        if not git.isGitInstalled():
            self.fail(
                "Git is not installed on your system.  All Git tests will fail."
            )

        #Local file
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, path = mdTestUtilities.createGzipFile(tempDir)
            self.assertFalse(
                git.isGitRepo(path),
                "git.isGitRepo(" + path + ") should have returned false.")
        finally:
            utilityFunctions.removeDir(tempDir)

        #Remote file
        path = "http://www.eng.lsu.edu/mirrors/apache//apr/apr-util-1.3.10.tar.gz"
        self.assertFalse(
            git.isGitRepo(path),
            "git.isGitRepo(" + path + ") should have returned false.")
示例#11
0
 def test_isGitInstalled(self):
     returnValue = git.isGitInstalled()
     self.assertEqual(
         returnValue, True,
         "Git is not installed on your system.  All Git tests will fail.")
示例#12
0
 def test_isGitInstalled(self):
     returnValue = git.isGitInstalled()
     self.assertEqual(returnValue, True, "Git is not installed on your system.  All Git tests will fail.")