Example #1
0
 def test_equality(self):
     self.assertEqual(VHosts.from_string(self.text),
                      VHosts.from_string(self.text))
     self.assertNotEqual(VHosts.from_string(self.text),
                         VHosts.from_string(
             '<VHOSTS>{0}</VHOSTS>'.format(str(self.vhost_0))))
     self.assertNotEqual(VHosts.from_string(self.text), [])
Example #2
0
 def test_equality(self):
     self.assertEqual(VHosts.from_string(self.text),
                      VHosts.from_string(self.text))
     self.assertNotEqual(
         VHosts.from_string(self.text),
         VHosts.from_string('<VHOSTS>{0}</VHOSTS>'.format(str(
             self.vhost_0))))
     self.assertNotEqual(VHosts.from_string(self.text), [])
Example #3
0
    def test_vhosts(self):
        text = '''
<VHOSTS custom="unknown">
  <VHOST />
  <UNKNOWN>
    <CUSTOM />
  </UNKNOWN>
</VHOSTS>'''
        vhosts = VHosts.from_string(text)
        tree = vhosts.to_lxml_element()
        self.assertEqual('unknown', tree.get('custom'))
        self.assertEqual(1, len(tree.findall('VHOST')))
        unknown = tree.findall('UNKNOWN')
        self.assertEqual(1, len(unknown))
        unknown = unknown[0]
        custom = list(unknown)
        self.assertEqual(1, len(custom))
        custom = custom[0]
        self.assertEqual('CUSTOM', custom.tag)
Example #4
0
    def test_vhosts(self):
        text = '''
<VHOSTS custom="unknown">
  <VHOST />
  <UNKNOWN>
    <CUSTOM />
  </UNKNOWN>
</VHOSTS>'''
        vhosts = VHosts.from_string(text)
        tree = vhosts.to_lxml_element()
        self.assertEqual('unknown', tree.get('custom'))
        self.assertEqual(1, len(tree.findall('VHOST')))
        unknown = tree.findall('UNKNOWN')
        self.assertEqual(1, len(unknown))
        unknown = unknown[0]
        custom = list(unknown)
        self.assertEqual(1, len(custom))
        custom = custom[0]
        self.assertEqual('CUSTOM', custom.tag)
Example #5
0
 def test_to_lxml(self):
     vhosts = VHosts.from_string(self.text)
     copy = VHosts.from_lxml_element(vhosts.to_lxml_element())
     self.assertEqual(vhosts, copy)
Example #6
0
 def test_to_string(self):
     vhosts = VHosts.from_string(self.text)
     copy = VHosts.from_string(str(vhosts))
     self.assertEqual(vhosts, copy)
Example #7
0
 def test_from_string(self):
     vhosts = VHosts.from_lxml_element(etree.XML(self.text))
     self.assertEqual(vhosts.VHosts[0], self.vhost_0)
     self.assertEqual(vhosts.VHosts[1], self.vhost_1)
Example #8
0
 def test_from_string(self):
     vhosts = VHosts.from_string(self.text)
     self.assertEqual(vhosts.VHosts[0], self.vhost_0)
     self.assertEqual(vhosts.VHosts[1], self.vhost_1)
Example #9
0
 def test_creation(self):
     vhosts = VHosts([self.vhost_0, self.vhost_1])
     self.assertEqual(vhosts.VHosts[0], self.vhost_0)
     self.assertEqual(vhosts.VHosts[1], self.vhost_1)
Example #10
0
 def test_to_lxml(self):
     vhosts = VHosts.from_string(self.text)
     copy = VHosts.from_lxml_element(vhosts.to_lxml_element())
     self.assertEqual(vhosts, copy)
Example #11
0
 def test_to_string(self):
     vhosts = VHosts.from_string(self.text)
     copy = VHosts.from_string(str(vhosts))
     self.assertEqual(vhosts, copy)
Example #12
0
 def test_from_string(self):
     vhosts = VHosts.from_lxml_element(etree.XML(self.text))
     self.assertEqual(vhosts.VHosts[0], self.vhost_0)
     self.assertEqual(vhosts.VHosts[1], self.vhost_1)
Example #13
0
 def test_from_string(self):
     vhosts = VHosts.from_string(self.text)
     self.assertEqual(vhosts.VHosts[0], self.vhost_0)
     self.assertEqual(vhosts.VHosts[1], self.vhost_1)
Example #14
0
 def get_vhost_configuration(self):
     '''Get VHosts settings.'''
     return VHosts.from_string(self.get_file('&&&vhost'))
Example #15
0
 def get_vhost_configuration(self):
     '''Get VHosts settings.'''
     return VHosts.from_string(self.get_file('&&&vhost'))