Пример #1
0
    def test_module_register(self):
        manager = module_mgr()
        module_list = manager.get_modules_name_list()
        self.assertFalse("test" in module_list)
        manager.register_module("test", ["coreutils"], ["/bin/ls"], "test module")
        module_list = manager.get_modules_name_list()
        self.assertTrue("test" in module_list)
        module_info = manager.get_module_info("test")
        self.assertEquals(module_info["module_name"], "test")
        self.assertEquals(module_info["comment"], "test module")
        found = False
        for requires in module_info["requires"]:
            if requires["name"] == "coreutils":
                found = True
                self.assertEquals(requires["type"], "rpm")
                self.assertTrue(requires["installed"])
        self.assertTrue(found)

        found = False
        for requires in module_info["requires"]:
            if requires["name"] == "/bin/ls":
                found = True
                self.assertEquals(requires["type"], "file")
                self.assertTrue(requires["installed"])
        self.assertTrue(found)

        manager.unregister_module("test")
        module_list = manager.get_modules_name_list()
        self.assertFalse("test" in module_list)
Пример #2
0
    def test_module_register(self):
        manager = module_mgr()
        module_list = manager.get_modules_name_list()
        self.assertFalse("test" in module_list)
        manager.register_module("test", ["coreutils"], ["/bin/ls"],
                                "test module")
        module_list = manager.get_modules_name_list()
        self.assertTrue("test" in module_list)
        module_info = manager.get_module_info("test")
        self.assertEquals(module_info["module_name"], "test")
        self.assertEquals(module_info["comment"], "test module")
        found = False
        for requires in module_info["requires"]:
            if requires["name"] == "coreutils":
                found = True
                self.assertEquals(requires["type"], "rpm")
                self.assertTrue(requires["installed"])
        self.assertTrue(found)

        found = False
        for requires in module_info["requires"]:
            if requires["name"] == "/bin/ls":
                found = True
                self.assertEquals(requires["type"], "file")
                self.assertTrue(requires["installed"])
        self.assertTrue(found)

        manager.unregister_module("test")
        module_list = manager.get_modules_name_list()
        self.assertFalse("test" in module_list)
Пример #3
0
def get_module_info(request):
    module_name = request.matchdict["module_name"]
    module_mgr = modulemgr.module_mgr()      # get module manager
    module_info = module_mgr.get_module_info(module_name)

    return module_info
Пример #4
0
def get_module_list(request):
    module_mgr = modulemgr.module_mgr()      # get module manager
    module_name_list = module_mgr.get_modules_name_list()

    return module_name_list
Пример #5
0
def get_module_info(request):
    module_name = request.matchdict["module_name"]
    module_mgr = modulemgr.module_mgr()  # get module manager
    module_info = module_mgr.get_module_info(module_name)

    return module_info
Пример #6
0
def get_module_list(request):
    module_mgr = modulemgr.module_mgr()  # get module manager
    module_name_list = module_mgr.get_modules_name_list()

    return module_name_list