Example #1
0
 def test_unpackTar(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createTarFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         pci = createPythonCallInfo(tarPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True,
                          "Local tar file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True,
                          "Tar file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True,
                          "Tar file was not a tar file after fetching.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True, "Tar file failed to unpack.")
         self.assertEqual(os.path.isdir(pci.currentPath), True,
                          "Tar file 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)
Example #2
0
    def test_processCommandline05(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            url = "http://www.webdav.org/neon/neon-0.29.5.tar.gz"
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)
            directory = os.path.join(tempDir, "c")
            os.mkdir(directory)

            testOptions = options.Options()
            commandline = "MixDown --import " + url + " " + tarPath + " " + directory
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), True,
                "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 3,
                              "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "neon",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, url,
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[1].name, "test",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[1].path, tarPath,
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[2].name, "c",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[2].path, directory,
                              "Target had wrong name")
            self.assertEquals(testOptions.validate(), True,
                              "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Example #3
0
    def test_processCommandline22(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown -v -i --import " + tarPath
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), True,
                "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 1,
                              "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "test",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, tarPath,
                              "Target had wrong name")
            self.assertEquals(testOptions.verbose, True,
                              "verbose should have been set")
            self.assertEquals(testOptions.interactive, True,
                              "interactive should have been set")
            self.assertEquals(testOptions.validate(), True,
                              "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Example #4
0
    def test_processCommandline09(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " --import --clean"
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), False, "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [], "targetsToImport should have not been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Example #5
0
 def test_fetchTar(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createTarFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         pci = createPythonCallInfo(tarPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True, "Local tar file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True, "Tar file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Tar file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
Example #6
0
    def test_processCommandline06(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown --import " + tarPath
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), True, "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 1, "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "test", "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, tarPath, "Target had wrong name")
            self.assertEquals(testOptions.validate(), True, "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Example #7
0
    def test_processCommandline09(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " --import --clean"
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), False,
                "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [],
                              "targetsToImport should have not been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Example #8
0
    def test_processCommandline05(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            url = "http://www.webdav.org/neon/neon-0.29.5.tar.gz"
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)
            directory = os.path.join(tempDir, "c")
            os.mkdir(directory)

            testOptions = options.Options()
            commandline = "MixDown --import " + url + " " + tarPath + " " + directory
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), True, "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 3, "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "neon", "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, url, "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[1].name, "test", "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[1].path, tarPath, "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[2].name, "c", "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[2].path, directory, "Target had wrong name")
            self.assertEquals(testOptions.validate(), True, "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)