Ejemplo n.º 1
0
    def testCustomModuleLifeCycle(self):
        name = shellExt("thisisatestmodule")

        tree = utils.callRpcCommand("upload usermodule %s" % name,
                                    files.executable(isWindows(),
                                                     'thisisatest'),
                                    no_xml=True)

        # check upload worked
        tree = utils.callRpcCommand("modulemng list")

        self.assertIn(name, [n.text for n in tree.findall('module/name')])

        tree = utils.callRpcCommand("modulemng get %s" % name)

        module = tree.find('module')
        self.assertEquals('modules', tree.tag)
        self.assertChildText(module, 'name', name)
        self.assertChildText(module, 'version', '0')
        self.assertChildText(module, 'type', 'Custom')
        self.assertChildText(module, 'upgradable', 'true')

        # try calling the command
        tree = utils.callRpcCommand("exec script %s" % name)

        self.assertEquals('test', tree.tag)
        self.assertEquals('this is a test', tree.text)

        # remove module
        tree = utils.callRpcCommand("remove usermodule %s" % name, no_xml=True)

        # check module not in the list after remove
        tree = utils.callRpcCommand("modulemng list")

        self.assertNotIn(name, [n.text for n in tree.findall('module/name')])
Ejemplo n.º 2
0
    def testUpdateLowerVersion(self):
        tree = utils.callRpcCommand('updateModule systemstatus 100',
                                    files.module('xmlecho'), no_xml=True)

        utils.checkModuleAndVersion('systemstatus', 100)

        result = utils.callRpcCommandError('updateModule systemstatus 9',
                                           files.executable(isWindows(), 'xmlecho'))

        utils.checkModuleAndVersion('systemstatus', 100)
Ejemplo n.º 3
0
    def testCustomModuleLifeCycle(self):
        name = shellExt("thisisatestmodule")

        tree = utils.callRpcCommand("upload usermodule %s" % name,
                                    files.executable(isWindows(), 'thisisatest'),
                                    no_xml=True)

        # check upload worked
        tree = utils.callRpcCommand("modulemng list")

        self.assertIn(name,
                      [n.text for n in tree.findall('module/name')])

        tree = utils.callRpcCommand("modulemng get %s" % name)

        module = tree.find('module')
        self.assertEquals('modules', tree.tag)
        self.assertChildText(module, 'name', name)
        self.assertChildText(module, 'version', '0')
        self.assertChildText(module, 'type', 'Custom')
        self.assertChildText(module, 'upgradable', 'true')

        # try calling the command
        tree = utils.callRpcCommand("exec script %s" % name)

        self.assertEquals('test', tree.tag)
        self.assertEquals('this is a test', tree.text)

        # remove module
        tree = utils.callRpcCommand("remove usermodule %s" % name, no_xml=True)

        # check module not in the list after remove
        tree = utils.callRpcCommand("modulemng list")

        self.assertNotIn(name,
                         [n.text for n in tree.findall('module/name')])
Ejemplo n.º 4
0
 def setUp(self):
     utils.uploadUserModule(shellExt("xmlecho"),
                            files.executable(isWindows(), 'xmlecho'))
Ejemplo n.º 5
0
 def testUpdateSystemModule(self):
     result = utils.callRpcCommandError('updateModule modulemng 100000',
                                        files.executable(isWindows(), 'xmlecho'))
Ejemplo n.º 6
0
 def setUp(self):
     utils.uploadUserModule('remove1',
                            files.executable(isWindows(), 'xmlecho'))
Ejemplo n.º 7
0
    def testNotExecutable(self):
        utils.uploadUserModule('upload3',
                               files.executable(isWindows(), 'xmlecho'))

        result = utils.callRpcCommandError('upload3')
Ejemplo n.º 8
0
 def setUp(self):
     utils.uploadUserModule('remove1',
                            files.executable(isWindows(), 'xmlecho'))