Example #1
0
 def test_to_string_definitions(self):
     config = MyServerConfig([
         DefinitionElement('a'),
         DefinitionTree(
             definitions=[DefinitionElement('b'),
                          DefinitionElement('c')])
     ])
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)
Example #2
0
    def test_from_lxml_definitions(self):
        text = '''<MYSERVER>
  <DEFINE name="a" />
  <DEFINE>
    <DEFINE name="b" />
    <DEFINE name="c" />
  </DEFINE>
</MYSERVER>'''
        config = MyServerConfig.from_lxml_element(etree.XML(text))
        right = MyServerConfig([DefinitionElement('a'), DefinitionTree(
                    definitions = [DefinitionElement('b'),
                                   DefinitionElement('c')])])
        self.assertEqual(config, right)
Example #3
0
    def test_from_lxml_definitions(self):
        text = '''<MYSERVER>
  <DEFINE name="a" />
  <DEFINE>
    <DEFINE name="b" />
    <DEFINE name="c" />
  </DEFINE>
</MYSERVER>'''
        config = MyServerConfig.from_lxml_element(etree.XML(text))
        right = MyServerConfig([
            DefinitionElement('a'),
            DefinitionTree(
                definitions=[DefinitionElement('b'),
                             DefinitionElement('c')])
        ])
        self.assertEqual(config, right)
Example #4
0
 def test_from_lxml(self):
     text = '<MYSERVER />'
     config = MyServerConfig.from_lxml_element(etree.XML(text))
     right = MyServerConfig()
     self.assertEqual(config, right)
Example #5
0
 def test_to_string(self):
     config = MyServerConfig()
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)
Example #6
0
 def test_from_lxml(self):
     text = '<MYSERVER />'
     config = MyServerConfig.from_lxml_element(etree.XML(text))
     right = MyServerConfig()
     self.assertEqual(config, right)
Example #7
0
 def test_to_string_definitions(self):
     config = MyServerConfig([DefinitionElement('a'), DefinitionTree(
                 definitions = [DefinitionElement('b'),
                                DefinitionElement('c')])])
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)
Example #8
0
 def test_to_string(self):
     config = MyServerConfig()
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)