Beispiel #1
0
    def testExecArgs(self):
        tree = utils.callRpcCommand("exec script %s arg1 arg2" % shellExt("xmlecho"))

        self.assertEquals('test', tree.tag)
        self.assertEquals(2, len(list(tree)))
        self.assertEquals(['arg1', 'arg2'],
                          [n.text for n in list(tree)])
Beispiel #2
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')])
Beispiel #3
0
 def setUp(self):
     utils.uploadUserModule(shellExt("xmlecho"),
                            files.executable(isWindows(), 'xmlecho'))
Beispiel #4
0
    def testExecNoArgs(self):
        tree = utils.callRpcCommand("exec script %s" % shellExt("xmlecho"))

        self.assertEquals('test', tree.tag)
        self.assertEquals(0, len(list(tree)))
Beispiel #5
0
 def setUp(self):
     utils.deleteUserModule(shellExt("thisisatestmodule"))