Beispiel #1
0
    def test_from_lxml_full(self):
        text = '''
<CONDITION name="name" value="value" not="yes" regex="yes">
  <PERMISSION />
  <RETURN />
</CONDITION>'''
        condition = Condition.from_lxml_element(etree.XML(text))
        right = Condition('name', 'value', True, True,
                          [Permission(), Return()])
        self.assertEqual(condition, right)
Beispiel #2
0
    def test_from_lxml_full(self):
        text = '''
<CONDITION name="name" value="value" not="yes" regex="yes">
  <PERMISSION />
  <RETURN />
</CONDITION>'''
        condition = Condition.from_lxml_element(etree.XML(text))
        right = Condition('name', 'value', True, True,
                          [Permission(), Return()])
        self.assertEqual(condition, right)
Beispiel #3
0
 def test_to_lxml_name(self):
     condition = Condition(name = 'name')
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #4
0
 def test_from_lxml_sub_elements(self):
     text = '<CONDITION><PERMISSION /><RETURN /></CONDITION>'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition(sub_elements = [Permission(), Return()])
     self.assertEqual(condition, right)
Beispiel #5
0
 def test_from_lxml_regex(self):
     text = '<CONDITION regex="yes" />'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition(regex = True)
     self.assertEqual(condition, right)
Beispiel #6
0
 def test_from_lxml_value(self):
     text = '<CONDITION value="test" />'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition(value = 'test')
     self.assertEqual(condition, right)
Beispiel #7
0
 def test_from_lxml_value(self):
     text = '<CONDITION value="test" />'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition(value='test')
     self.assertEqual(condition, right)
Beispiel #8
0
 def test_to_lxml_sub_elements(self):
     condition = Condition(sub_elements = [Permission(), Return()])
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #9
0
 def test_to_lxml_sub_elements(self):
     condition = Condition(sub_elements=[Permission(), Return()])
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #10
0
 def test_to_lxml_regex(self):
     condition = Condition(regex=True)
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #11
0
 def test_to_lxml_value(self):
     condition = Condition(value='value')
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #12
0
 def test_to_lxml_name(self):
     condition = Condition(name='name')
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #13
0
 def test_from_lxml_sub_elements(self):
     text = '<CONDITION><PERMISSION /><RETURN /></CONDITION>'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition(sub_elements=[Permission(), Return()])
     self.assertEqual(condition, right)
Beispiel #14
0
 def test_from_lxml_regex(self):
     text = '<CONDITION regex="yes" />'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition(regex=True)
     self.assertEqual(condition, right)
Beispiel #15
0
 def test_to_lxml_value(self):
     condition = Condition(value = 'value')
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #16
0
 def test_to_lxml_full(self):
     condition = Condition('name', 'value', True, True,
                           [Permission(), Return()])
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #17
0
 def test_to_lxml_regex(self):
     condition = Condition(regex = True)
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #18
0
 def test_from_lxml(self):
     text = '<CONDITION />'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition()
     self.assertEqual(condition, right)
Beispiel #19
0
 def test_to_lxml_full(self):
     condition = Condition('name', 'value', True, True,
                           [Permission(), Return()])
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
Beispiel #20
0
 def test_from_lxml(self):
     text = '<CONDITION />'
     condition = Condition.from_lxml_element(etree.XML(text))
     right = Condition()
     self.assertEqual(condition, right)