예제 #1
0
    def runTest(self):

        # Test that everything in version.versionMap has a handler, except
        # for DEVEL.
        for (name, vers) in list(versionMap.items()):
            if name == "DEVEL":
                continue

            self.assertEqual(returnClassForVersion(vers).version, vers)

        # test that unknown version will raise an exception
        import pykickstart.version as ver
        orig_versionToString = ver.versionToString
        with self.assertRaises(KickstartVersionError):
            def fake_versionToString(version, skipDevel=False):
                return "-1"

            ver.versionToString = fake_versionToString
            ver.returnClassForVersion(-1)
        ver.versionToString = orig_versionToString

        # Load the handlers
        _path = os.path.join(os.path.dirname(__file__), "..", "pykickstart", "handlers")
        _path = os.path.abspath(_path)
        for module in loadModules(_path, cls_pattern="Handler", skip_list=["control"]):
            if module.__name__.endswith("Handler") and module.__name__ not in ["BaseHandler"]:
                # What is the version of the handler?
                vers = module.__name__.replace("Handler", "")
                self.assertTrue(vers in versionMap)
                # Ensure that returnClassForVersion returns what we expect
                self.assertEqual(getClassName(returnClassForVersion(versionMap[vers])), getClassName(module))
예제 #2
0
    def runTest(self):

        # Test that everything in version.versionMap has a handler, except
        # for DEVEL.
        for (name, vers) in list(versionMap.items()):
            if name == "DEVEL":
                continue

            self.assertEqual(returnClassForVersion(vers).version, vers)

        # Load the handlers
        import pykickstart.handlers
        for module in loadModules(pykickstart.handlers.__path__[0],
                                  cls_pattern="Handler",
                                  skip_list=["control"]):
            if module.__name__.endswith("Handler") and module.__name__ not in [
                    "BaseHandler"
            ]:
                # What is the version of the handler?
                vers = module.__name__.replace("Handler", "")
                self.assertTrue(vers in versionMap)
                # Ensure that returnClassForVersion returns what we expect
                self.assertEqual(
                    getClassName(returnClassForVersion(versionMap[vers])),
                    getClassName(module))
예제 #3
0
    def runTest(self):

        # Test that everything in version.versionMap has a handler, except
        # for DEVEL.
        for (name, vers) in list(versionMap.items()):
            if name == "DEVEL":
                continue

            self.assertEqual(returnClassForVersion(vers).version, vers)

        # test that unknown version will raise an exception
        import pykickstart.version as ver
        orig_versionToString = ver.versionToString
        with self.assertRaises(KickstartVersionError):
            def fake_versionToString(version, skipDevel = False):
                return "-1"

            ver.versionToString = fake_versionToString
            ver.returnClassForVersion(-1)
        ver.versionToString = orig_versionToString

        # Load the handlers
        import pykickstart.handlers
        for module in loadModules(pykickstart.handlers.__path__[0], cls_pattern="Handler", skip_list=["control"]):
            if module.__name__.endswith("Handler") and module.__name__ not in ["BaseHandler"]:
                # What is the version of the handler?
                vers = module.__name__.replace("Handler","")
                self.assertTrue(vers in versionMap)
                # Ensure that returnClassForVersion returns what we expect
                self.assertEqual(getClassName(returnClassForVersion(versionMap[vers])), getClassName(module))
예제 #4
0
    def runTest(self):

        # Test that everything in version.versionMap has a handler, except
        # for DEVEL.
        for (name, vers) in list(versionMap.items()):
            if name == "DEVEL":
                continue

            self.assertEqual(returnClassForVersion(vers).version, vers)

        # Load the handlers
        import pykickstart.handlers
        for module in loadModules(pykickstart.handlers.__path__[0], cls_pattern="Handler", skip_list=["control"]):
            if module.__name__.endswith("Handler") and module.__name__ not in ["BaseHandler"]:
                # What is the version of the handler?
                vers = module.__name__.replace("Handler","")
                self.assertTrue(vers in versionMap)
                # Ensure that returnClassForVersion returns what we expect
                self.assertEqual(getClassName(returnClassForVersion(versionMap[vers])), getClassName(module))