def test_to_xml(self):
        root = TemplateNode()
        node = TemplateProgramNode()
        root.append(node)

        xml = root.xml_tree(self._client_context)
        self.assertIsNotNone(xml)
        xml_str = ET.tostring(xml, "utf-8").decode("utf-8")
        self.assertEqual("<template><program /></template>", xml_str)
Example #2
0
    def test_node(self):
        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplateProgramNode()
        self.assertIsNotNone(node)

        root.append(node)
        self.assertEqual(len(root.children), 1)

        self._client_context.brain.properties.add_property("fullname", "testbot")
        self._client_context.brain.properties.add_property("version", "1.0.0")

        self.assertEqual(root.resolve(self._client_context), "testbot 1.0.0")
Example #3
0
    def test_node(self):
        test_bot = Bot(Brain(BrainConfiguration()), BotConfiguration())

        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplateProgramNode()
        self.assertIsNotNone(node)

        root.append(node)
        self.assertEqual(len(root.children), 1)

        test_bot.brain.properties.add_property("fullname", "testbot")
        test_bot.brain.properties.add_property("version", "1.0.0")

        self.assertEqual(root.resolve(test_bot, "testid"), "testbot 1.0.0")
 def __init__(self):
     TemplateProgramNode.__init__(self)
Example #5
0
 def __init__(self):
     TemplateProgramNode.__init__(self)