Example #1
0
    def testInstallationOrder2(self):
        import firmwaretools.repository as repository
        import firmwaretools.package as package

        p = package.Device(name="testorder1",
                           version="a01",
                           displayname="fake")

        q = package.Device(name="testorder2",
                           version="a08",
                           displayname="fake")

        r = package.Device(name="testorder3",
                           version="a01",
                           displayname="fake")

        systemInventory = [r, p, q]
        r = repository.Repository(datafiles)

        installationOrder = ["testorder1", "testorder3"]
        updateSet = generateUpdateSet(r, systemInventory)
        for pkg in updateSet.generateInstallationOrder():
            n = installationOrder[0]
            if len(installationOrder) > 1:
                installationOrder = installationOrder[1:]

            self.assertEqual(n, pkg.name)
Example #2
0
    def testGenerateUpdateSetMultiple(self):
        import firmwaretools.repository as repository
        import firmwaretools.package as package

        p = package.Device(name="testpack", version="a04", displayname="fake")

        q = package.Device(name="testpack_different",
                           version="a04",
                           displayname="fake")

        r = package.Device(name="testpack_another",
                           version="a05",
                           displayname="fake")

        systemInventory = [p, q, r]
        repo = repository.Repository(datafiles)
        updateSet = generateUpdateSet(repo, systemInventory)

        self.assertEqual(
            updateSet.getUpdatePackageForDevice(p).name, "testpack")
        self.assertEqual(updateSet.getUpdatePackageForDevice(p).version, "a06")
        self.assertEqual(
            updateSet.getUpdatePackageForDevice(q).name, "testpack_different")
        self.assertEqual(updateSet.getUpdatePackageForDevice(q).version, "a07")
        self.failUnless(updateSet.getUpdatePackageForDevice(r) is None)
Example #3
0
 def testGenerateUpdateSetInstallDefault(self):
     import firmwaretools.repository as repository
     import firmwaretools.package as package
     p = package.Device(name="testpack", version="a04", displayname="fake")
     systemInventory = [
         p,
     ]
     r = repository.Repository(datafiles)
     updateSet = generateUpdateSet(r, systemInventory)
     self.assertRaises(package.NoInstaller,
                       updateSet.getUpdatePackageForDevice(p).install)
Example #4
0
    def testGenerateUpdateSet3(self):
        import firmwaretools.repository as repository
        import firmwaretools.package as package
        p = package.Device(name="testpack", version="a08", displayname="fake")
        systemInventory = [
            p,
        ]
        r = repository.Repository(datafiles)
        updateSet = generateUpdateSet(r, systemInventory)

        self.failUnless(updateSet.getUpdatePackageForDevice(p) is None)
Example #5
0
    def testGenerateUpdateSet_SystemSpecific3(self):
        # test the case where system specific update available that does
        # apply to current system
        import firmwaretools.repository as repository
        import firmwaretools.package as package

        p = package.Device(name="system_specific",
                           version="a01",
                           displayname="fake")

        q = package.Device(name="system_bios(ven_0x5555_dev_0x4321)",
                           version="a00",
                           displayname="fake")

        systemInventory = [p, q]
        r = repository.Repository(datafiles)
        updateSet = generateUpdateSet(r, systemInventory)

        self.assertEqual(
            updateSet.getUpdatePackageForDevice(p).name, "system_specific")
        self.assertEqual(updateSet.getUpdatePackageForDevice(p).version, "a09")
Example #6
0
    def testGenerateUpdateSet1(self):
        import firmwaretools.repository as repository
        import firmwaretools.package as package
        p = package.Device(name="testpack", version="a04", displayname="fake")
        systemInventory = [
            p,
        ]
        r = repository.Repository(datafiles)
        updateSet = generateUpdateSet(r, systemInventory)

        self.assertEqual(
            updateSet.getUpdatePackageForDevice(p).name, "testpack")
        self.assertEqual(updateSet.getUpdatePackageForDevice(p).version, "a06")
Example #7
0
 def testGenerateUpdateSetInstall(self):
     import firmwaretools.repository as repository
     import firmwaretools.package as package
     p = package.Device(name="testpack_different",
                        version="a04",
                        displayname="fake")
     systemInventory = [
         p,
     ]
     r = repository.Repository(datafiles)
     updateSet = generateUpdateSet(r, systemInventory)
     res = updateSet.getUpdatePackageForDevice(p).install()
     self.assertEqual(res, "SUCCESS")
Example #8
0
    def testGenerateUpdateSet_testRequires2(self):
        # test the case where system specific update available that does
        # apply to current system
        import firmwaretools.repository as repository
        import firmwaretools.package as package

        p = package.Device(name="test_requires",
                           version="a01",
                           displayname="fake")

        q = package.Device(name="otherpackage",
                           version="a00",
                           displayname="fake")

        r = package.Device(name="foo", version="43", displayname="fake")

        systemInventory = [p, q, r]
        repo = repository.Repository(datafiles)
        updateSet = generateUpdateSet(repo, systemInventory)

        self.assertEqual(
            updateSet.getUpdatePackageForDevice(p).name, "test_requires")
        self.assertEqual(updateSet.getUpdatePackageForDevice(p).version, "a09")
Example #9
0
    def testGenerateUpdateSet_SystemSpecific1(self):
        # test the case where system specific update available that doesn't
        # apply to current system
        import firmwaretools.repository as repository
        import firmwaretools.package as package
        p = package.Device(name="system_specific",
                           version="a01",
                           displayname="fake")
        systemInventory = [
            p,
        ]
        r = repository.Repository(datafiles)
        updateSet = generateUpdateSet(r, systemInventory)

        self.failUnless(updateSet.getUpdatePackageForDevice(p) is None)