Пример #1
0
    def test_isHgRepoCase2(self):
        #Case 2: URL that is a Hg repository
        if not hg.isHgInstalled():
            self.fail("Hg is not installed on your system.  All Hg tests will fail.")

        path = "http://selenic.com/repo/hello"
        self.assertTrue(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned true.")
        #Test if wrong path returns false
        falsePath = "http://foo/wrong/path"
        returnValue = hg.isHgRepo(falsePath)
        self.assertEqual(returnValue, False, "hg.isHgRepo(" + falsePath + ") should have returned false.")
Пример #2
0
 def test_isHgRepoCase1(self):
     #Case 1: Local directory that is a Hg repository
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     #Create repository and test if is Hg repo
     tempDir = mdTestUtilities.makeTempDir()
     path = mdTestUtilities.createHgRepository(tempDir)
     try:
         self.assertTrue(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(hg.isHgRepo(falsePath), "hg.isHgRepo(" + falsePath + ") should have returned false.")
Пример #3
0
 def test_isHgRepo(self):
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     #Create repository and test if is hg repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createHgRepository(tempDir)
     try:
         returnValue = hg.isHgRepo(tempRepo)
         self.assertEqual(returnValue, True, "hg.isHgRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "http://foo/wrong/path"
     returnValue = hg.isHgRepo(falsePath)
     self.assertEqual(returnValue, False, "hg.isHgRepo(" + falsePath + ") should have returned false.")
Пример #4
0
    def test_isHgRepoCase4(self):
        #Case 4: Check for false positive with .gz files
        if not hg.isHgInstalled():
            self.fail("Hg is not installed on your system.  All Hg tests will fail.")

        #Local file
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, path = mdTestUtilities.createGzipFile(tempDir)
            self.assertFalse(hg.isHgRepo(path), "hg.isHgRepo(" + 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(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned false.")