Пример #1
0
 def test_to_lxml_full(self):
     vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                   [Log('ACCESSLOG'), Log('WARNINGLOG')],
                   ['127.0.0.0/8', '192.168.0.0/16'],
                   {'host.domain': True, 'test.domain': None},
                   'private_key', 'certificate')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #2
0
 def test_to_lxml_full(self):
     vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                   [Log('ACCESSLOG'), Log('WARNINGLOG')],
                   ['127.0.0.0/8', '192.168.0.0/16'], {
                       'host.domain': True,
                       'test.domain': None
                   }, 'private_key', 'certificate')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #3
0
    def test_from_lxml_full(self):
        text = '''<VHOST>
  <NAME>test vhost</NAME>
  <PORT>80</PORT>
  <PROTOCOL>HTTP</PROTOCOL>
  <DOCROOT>/www</DOCROOT>
  <SYSROOT>/system</SYSROOT>
  <ACCESSLOG />
  <WARNINGLOG />
  <IP>127.0.0.0/8</IP>
  <IP>192.168.0.0/16</IP>
  <HOST useRegex="YES">host.domain</HOST>
  <HOST>test.domain</HOST>
  <SSL_PRIVATEKEY>private_key</SSL_PRIVATEKEY>
  <SSL_CERTIFICATE>certificate</SSL_CERTIFICATE>
</VHOST>'''
        vhost = VHost.from_lxml_element(etree.XML(text))
        right = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                      [Log('ACCESSLOG'), Log('WARNINGLOG')],
                      ['127.0.0.0/8', '192.168.0.0/16'],
                      {'host.domain': True, 'test.domain': None},
                      'private_key', 'certificate')
        self.assertEqual(vhost, right)
Пример #4
0
    def test_from_lxml_full(self):
        text = '''<VHOST>
  <NAME>test vhost</NAME>
  <PORT>80</PORT>
  <PROTOCOL>HTTP</PROTOCOL>
  <DOCROOT>/www</DOCROOT>
  <SYSROOT>/system</SYSROOT>
  <ACCESSLOG />
  <WARNINGLOG />
  <IP>127.0.0.0/8</IP>
  <IP>192.168.0.0/16</IP>
  <HOST useRegex="YES">host.domain</HOST>
  <HOST>test.domain</HOST>
  <SSL_PRIVATEKEY>private_key</SSL_PRIVATEKEY>
  <SSL_CERTIFICATE>certificate</SSL_CERTIFICATE>
</VHOST>'''
        vhost = VHost.from_lxml_element(etree.XML(text))
        right = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                      [Log('ACCESSLOG'), Log('WARNINGLOG')],
                      ['127.0.0.0/8', '192.168.0.0/16'], {
                          'host.domain': True,
                          'test.domain': None
                      }, 'private_key', 'certificate')
        self.assertEqual(vhost, right)
Пример #5
0
 def test_from_lxml_private_key(self):
     text = '<VHOST><SSL_PRIVATEKEY>private_key</SSL_PRIVATEKEY></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(private_key='private_key')
     self.assertEqual(vhost, right)
Пример #6
0
 def test_from_lxml_ip(self):
     text = '<VHOST><IP>127.0.0.0/8</IP></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(ip=['127.0.0.0/8'])
     self.assertEqual(vhost, right)
Пример #7
0
 def test_from_lxml_sys_folder(self):
     text = '<VHOST><SYSROOT>/system</SYSROOT></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(sys_root='/system')
     self.assertEqual(vhost, right)
Пример #8
0
 def test_from_lxml_protocol(self):
     text = '<VHOST><PROTOCOL>HTTP</PROTOCOL></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(protocol='HTTP')
     self.assertEqual(vhost, right)
Пример #9
0
 def test_from_lxml_name(self):
     text = '<VHOST><NAME>test vhost</NAME></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost('test vhost')
     self.assertEqual(vhost, right)
Пример #10
0
 def test_to_lxml_host(self):
     vhost = VHost(host={'.*': True, 'a.org': None})
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #11
0
 def test_to_lxml_doc_root(self):
     vhost = VHost(doc_root='/www')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #12
0
 def test_from_lxml_certificate(self):
     text = '<VHOST><SSL_CERTIFICATE>certificate</SSL_CERTIFICATE></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(certificate = 'certificate')
     self.assertEqual(vhost, right)
Пример #13
0
 def test_from_lxml_private_key(self):
     text = '<VHOST><SSL_PRIVATEKEY>private_key</SSL_PRIVATEKEY></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(private_key = 'private_key')
     self.assertEqual(vhost, right)
Пример #14
0
 def test_from_lxml_host(self):
     text = '<VHOST><HOST useRegex="YES">.*</HOST><HOST>a.org</HOST></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(host = {'.*': True, 'a.org': None})
     self.assertEqual(vhost, right)
Пример #15
0
 def test_from_lxml_ip(self):
     text = '<VHOST><IP>127.0.0.0/8</IP></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(ip = ['127.0.0.0/8'])
     self.assertEqual(vhost, right)
Пример #16
0
 def test_from_lxml_logs(self):
     text = '<VHOST><ACCESSLOG /><SOMELOG /></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(logs = [Log('ACCESSLOG'), Log('SOMELOG')])
     self.assertEqual(vhost, right)
Пример #17
0
 def test_from_lxml_sys_folder(self):
     text = '<VHOST><SYSROOT>/system</SYSROOT></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(sys_root = '/system')
     self.assertEqual(vhost, right)
Пример #18
0
 def test_from_lxml_doc_root(self):
     text = '<VHOST><DOCROOT>/www</DOCROOT></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(doc_root = '/www')
     self.assertEqual(vhost, right)
Пример #19
0
 def test_to_lxml_port(self):
     vhost = VHost(port=80)
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #20
0
 def test_to_lxml_name(self):
     vhost = VHost('test vhost')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #21
0
 def test_to_lxml_logs(self):
     vhost = VHost(logs=[Log('ACCESSLOG'), Log('SOMELOG')])
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #22
0
 def test_to_lxml_port(self):
     vhost = VHost(port = 80)
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #23
0
 def test_from_lxml_protocol(self):
     text = '<VHOST><PROTOCOL>HTTP</PROTOCOL></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(protocol = 'HTTP')
     self.assertEqual(vhost, right)
Пример #24
0
 def test_to_lxml_protocol(self):
     vhost = VHost(protocol = 'HTTP')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #25
0
 def test_from_lxml_port(self):
     text = '<VHOST><PORT>80</PORT></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(port=80)
     self.assertEqual(vhost, right)
Пример #26
0
 def test_to_lxml_doc_root(self):
     vhost = VHost(doc_root = '/www')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #27
0
 def test_from_lxml_doc_root(self):
     text = '<VHOST><DOCROOT>/www</DOCROOT></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(doc_root='/www')
     self.assertEqual(vhost, right)
Пример #28
0
 def test_to_lxml_sys_root(self):
     vhost = VHost(sys_root = '/system')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #29
0
 def test_from_lxml_logs(self):
     text = '<VHOST><ACCESSLOG /><SOMELOG /></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(logs=[Log('ACCESSLOG'), Log('SOMELOG')])
     self.assertEqual(vhost, right)
Пример #30
0
 def test_to_lxml_logs(self):
     vhost = VHost(logs = [Log('ACCESSLOG'), Log('SOMELOG')])
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #31
0
 def test_from_lxml_host(self):
     text = '<VHOST><HOST useRegex="YES">.*</HOST><HOST>a.org</HOST></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(host={'.*': True, 'a.org': None})
     self.assertEqual(vhost, right)
Пример #32
0
 def test_to_lxml_ip(self):
     vhost = VHost(ip = ['127.0.0.0/8'])
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #33
0
 def test_from_lxml_certificate(self):
     text = '<VHOST><SSL_CERTIFICATE>certificate</SSL_CERTIFICATE></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(certificate='certificate')
     self.assertEqual(vhost, right)
Пример #34
0
 def test_to_lxml_host(self):
     vhost = VHost(host = {'.*': True, 'a.org': None})
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #35
0
 def test_to_lxml_name(self):
     vhost = VHost('test vhost')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #36
0
 def test_to_lxml_private_key(self):
     vhost = VHost(private_key = 'private_key')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #37
0
 def test_to_lxml_protocol(self):
     vhost = VHost(protocol='HTTP')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #38
0
 def test_to_lxml_certificate(self):
     vhost = VHost(certificate = 'certificate')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #39
0
 def test_to_lxml_sys_root(self):
     vhost = VHost(sys_root='/system')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #40
0
 def test_to_lxml_certificate(self):
     vhost = VHost(certificate='certificate')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #41
0
 def test_to_lxml_ip(self):
     vhost = VHost(ip=['127.0.0.0/8'])
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #42
0
 def test_from_lxml_name(self):
     text = '<VHOST><NAME>test vhost</NAME></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost('test vhost')
     self.assertEqual(vhost, right)
Пример #43
0
 def test_to_lxml_private_key(self):
     vhost = VHost(private_key='private_key')
     copy = VHost.from_lxml_element(vhost.to_lxml_element())
     self.assertEqual(vhost, copy)
Пример #44
0
 def test_from_lxml_port(self):
     text = '<VHOST><PORT>80</PORT></VHOST>'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost(port = 80)
     self.assertEqual(vhost, right)
Пример #45
0
 def test_from_lxml(self):
     text = '<VHOST />'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost()
     self.assertEqual(vhost, right)
Пример #46
0
 def test_from_lxml(self):
     text = '<VHOST />'
     vhost = VHost.from_lxml_element(etree.XML(text))
     right = VHost()
     self.assertEqual(vhost, right)