コード例 #1
0
ファイル: JarResourceTest.py プロジェクト: yoda-vid/jinn
    def setUp(self):

        self.fsHelp = FileSystemHelper()
        #save a copy of the original options file
        self.old_options = "manifest=\"manifests/import_manifest.json\"\n# TODO: Get rid of this\nmanifest_is_url = False\ninterface = \"cmd\"\nversion = \"DEV\""

        pass
コード例 #2
0
 def setUp(self):
     
     self.fsHelp = FileSystemHelper()
     #save a copy of the original options file
     self.old_options = "manifest=\"manifests/import_manifest.json\"\n# TODO: Get rid of this\nmanifest_is_url = False\ninterface = \"cmd\"\nversion = \"DEV\""
     
     pass
コード例 #3
0
ファイル: FileResourceTest.py プロジェクト: pombredanne/jinn
    def setUp(self):

        self.fsHelp = FileSystemHelper()
        # save a copy of the original options file
        self.old_options = 'manifest="manifests/import_manifest.json"\ninterface = "cmd"\nversion = "DEV"'

        if not self.fsHelp.exists("Jinn.py"):
            os.chdir("..")

        pass
コード例 #4
0
ファイル: Linux64InstallTest.py プロジェクト: yoda-vid/jinn
    def testInstallLinux64(self):
        self.assertEquals(OperatingSystem.LIN, self.j.getOperatingSystem(),
                          "operating system did not detect as Linux")
        self.assertEquals(Architecture.x64, self.j.getArchitecture(),
                          "architecture is not detected as x64")

        fsHelp = FileSystemHelper()
        os.system("python ../Jinn.py -install")

        #check for the existence of files
        #fsHelp.exists()
        pass
コード例 #5
0
ファイル: FileResourceTest.py プロジェクト: pombredanne/jinn
class Test(unittest.TestCase):
    def setUp(self):

        self.fsHelp = FileSystemHelper()
        # save a copy of the original options file
        self.old_options = 'manifest="manifests/import_manifest.json"\ninterface = "cmd"\nversion = "DEV"'

        if not self.fsHelp.exists("Jinn.py"):
            os.chdir("..")

        pass

    def tearDown(self):
        # re-write the options file
        optionsFile = open("../options.py", "w")
        optionsFile.write(self.old_options)
        optionsFile.close()
        pass

    # the names of these tests are to keep the order consistent
    # test to install a file resource
    def testA_InstallSingleFileResource(self):

        self.setManifest("manifests/file_manifest.json")

        self.setUpOS()

        res = os.system("python Jinn.py -install")

        self.assertEqual(res, 0, "Exit code must be zero")

        # check for the existence of files
        if self.os == OperatingSystem.LIN:
            if self.arch == Architecture.x64:
                self.checkExistsLinux64()
            if self.arch == Architecture.x32:
                self.checkExistsLinux32()

        pass

    # test to uninstall a file resource
    def testB_UninstallSingleFileResource(self):

        self.setManifest("manifests/file_manifest.json")

        self.setUpOS()

        res = os.system("python Jinn.py -uninstall")

        self.assertEqual(res, 0, "Exit code must be zero")

        # check for the existence of files
        if self.os == OperatingSystem.LIN:
            if self.arch == Architecture.x64:
                self.checkDeletedLinux64()
            if self.arch == Architecture.x32:
                self.checkDeletedLinux32()

        pass

    # def testUpdateSingleResource(self):

    #    pass

    def checkExistsLinux64(self):
        self.assertTrue(self.fsHelp.exists("TestData/humans.txt"))
        pass

    def checkExistsLinux32(self):
        self.assertTrue(self.fsHelp.exists("TestData/humans.txt"))
        pass

    def checkDeletedLinux64(self):
        self.assertFalse(self.fsHelp.exists("TestData/humans.txt"))
        self.assertFalse(self.fsHelp.exists("TestData"))
        self.assertFalse(self.fsHelp.exists(".jinn"))
        pass

    def checkDeletedLinux32(self):
        self.assertFalse(self.fsHelp.exists("TestData/humans.txt"))
        self.assertFalse(self.fsHelp.exists("TestData"))
        self.assertFalse(self.fsHelp.exists(".jinn"))
        pass

    def setManifest(self, path):
        # out new options file with the test manifest
        testoptions = 'manifest="' + path + '"\ninterface = "cmd"\nversion = "DEV"\nmin_log_level="DEBUG"'

        optionsFile = open("options.py", "w")
        optionsFile.write(testoptions)
        optionsFile.close()
        pass

    def setUpOS(self):
        import Jinn

        self.j = Jinn.Jinn()

        self.os = self.j.detector.getOperatingSystem()
        self.arch = self.j.detector.getArchitecture(self.os)
コード例 #6
0
ファイル: JarResourceTest.py プロジェクト: yoda-vid/jinn
class Test(unittest.TestCase):
    def setUp(self):

        self.fsHelp = FileSystemHelper()
        #save a copy of the original options file
        self.old_options = "manifest=\"manifests/import_manifest.json\"\n# TODO: Get rid of this\nmanifest_is_url = False\ninterface = \"cmd\"\nversion = \"DEV\""

        pass

    def tearDown(self):
        #re-write the options file
        optionsFile = open("../options.py", "w")
        optionsFile.write(self.old_options)
        optionsFile.close()
        pass

    #the names of these tests are to keep the order consistent
    # test to install an archive resource
    def testA_InstallSingleArchiveResource(self):

        self.setManifest("manifests/jar_manifest.json")

        self.setUpOS()

        os.system("python ../Jinn.py -install")

        #check for the existence of files
        if (self.os == OperatingSystem.LIN):
            if (self.arch == Architecture.x64):
                self.checkExistsLinux64()
            if (self.arch == Architecture.x32):
                self.checkExistsLinux32()

        pass

    # test to uninstall an archive resource
    def testB_UninstallSingleArchiveResource(self):

        self.setManifest("manifests/updates/jar/add/1.json")

        self.setUpOS()

        os.system("python ../Jinn.py -uninstall")

        #check for the existence of files
        if (self.os == OperatingSystem.LIN):
            if (self.arch == Architecture.x64):
                self.checkDeletedLinux64()
            if (self.arch == Architecture.x32):
                self.checkDeletedLinux32()

        pass

    #def testUpdateSingleResource(self):

    #    pass

    def checkExistsLinux64(self):
        self.assertTrue(self.fsHelp.exists("../jre/bin"))
        pass

    def checkExistsLinux32(self):
        self.assertTrue(self.fsHelp.exists("../jre/bin"))
        pass

    def checkDeletedLinux64(self):
        self.assertFalse(self.fsHelp.exists("../jre/bin"))
        self.assertFalse(self.fsHelp.exists("../jre"))
        self.assertFalse(self.fsHelp.exists("../.jinn"))
        pass

    def checkDeletedLinux32(self):
        self.assertFalse(self.fsHelp.exists("../jre/bin"))
        self.assertFalse(self.fsHelp.exists("../jre"))
        self.assertFalse(self.fsHelp.exists("../.jinn"))
        pass

    def setManifest(self, path):
        #out new options file with the test manifest
        testoptions = "manifest=\"" + path + "\"\n# TODO: Get rid of this\nmanifest_is_url = False\ninterface = \"cmd\"\nversion = \"DEV\""

        optionsFile = open("../options.py", "w")
        optionsFile.write(testoptions)
        optionsFile.close()
        pass

    def setUpOS(self):
        import Jinn
        self.j = Jinn.Jinn()

        self.os = self.j.getOperatingSystem()
        self.arch = self.j.getArchitecture()
コード例 #7
0
class Test(unittest.TestCase):


    def setUp(self):
        
        self.fsHelp = FileSystemHelper()
        #save a copy of the original options file
        self.old_options = "manifest=\"manifests/import_manifest.json\"\n# TODO: Get rid of this\nmanifest_is_url = False\ninterface = \"cmd\"\nversion = \"DEV\""
        
        pass


    def tearDown(self):
        #re-write the options file
        optionsFile = open("../options.py","w")
        optionsFile.write(self.old_options);
        optionsFile.close()
        pass
    
    #the names of these tests are to keep the order consistent
    # test to install an archive resource
    def testA_InstallSingleArchiveResource(self):
        

        self.setManifest("manifests/archive_manifest.json")
        
        self.setUpOS()
        
        os.system("python ../Jinn.py -install");
        
        #check for the existence of files
        if(self.os == OperatingSystem.LIN):
            if(self.arch == Architecture.x64):
                self.checkExistsLinux64()
                pass
            if(self.arch == Architecture.x32):
                self.checkExistsLinux32()
        
        
        pass
    
    # test to uninstall an archive resource
    def testB_UninstallSingleArchiveResource(self):
        

        self.setManifest("manifests/archive_manifest.json")
        
        self.setUpOS()
        
        os.system("python ../Jinn.py -uninstall");
        
        #check for the existence of files
        if(self.os == OperatingSystem.LIN):
            if(self.arch == Architecture.x64):
                self.checkDeletedLinux64()
                pass
            if(self.arch == Architecture.x32):
                self.checkDeletedLinux32()
        
        
        pass
    
    #def testUpdateSingleResource(self):
        
    #    pass
    
    def checkExistsLinux64(self):
        self.assertTrue(self.fsHelp.exists("../TestData/examples"))
        pass
    
    def checkExistsLinux32(self):
        self.assertTrue(self.fsHelp.exists("../TestData/examples"))
        pass
    
    def checkDeletedLinux64(self):
        self.assertFalse(self.fsHelp.exists("../TestData/examples"))
        self.assertFalse(self.fsHelp.exists("../TestData"))
        self.assertFalse(self.fsHelp.exists("../.jinn"))
        pass
    
    def checkDeletedLinux32(self):
        self.assertFalse(self.fsHelp.exists("../TestData/examples"))
        self.assertFalse(self.fsHelp.exists("../TestData"))
        self.assertFalse(self.fsHelp.exists("../.jinn"))
        pass
    
    def setManifest(self, path):
        #out new options file with the test manifest
        testoptions = "manifest=\""+path+"\"\n# TODO: Get rid of this\nmanifest_is_url = False\ninterface = \"cmd\"\nversion = \"DEV\""
        
        optionsFile = open("../options.py","w")
        optionsFile.write(testoptions);
        optionsFile.close()
        pass

    def setUpOS(self):
        import Jinn
        self.j = Jinn.Jinn()
        
        self.os = self.j.getOperatingSystem()
        self.arch = self.j.getArchitecture()