Пример #1
0
 def test_sys_root(self):
     vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system')
     self.assertEqual('/system', vhost.get_sys_root())
     vhost.set_sys_root('/var/system')
     self.assertEqual('/var/system', vhost.get_sys_root())
     vhost.set_sys_root(None)
     self.assertEqual(None, vhost.get_sys_root())
     vhost = VHost(sys_root='/system')
     self.assertEqual('/system', vhost.get_sys_root())
Пример #2
0
 def test_sys_root(self):
     vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system')
     self.assertEqual('/system', vhost.get_sys_root())
     vhost.set_sys_root('/var/system')
     self.assertEqual('/var/system', vhost.get_sys_root())
     vhost.set_sys_root(None)
     self.assertEqual(None, vhost.get_sys_root())
     vhost = VHost(sys_root = '/system')
     self.assertEqual('/system', vhost.get_sys_root())
Пример #3
0
 def test_equality(self):
     vhost_0 = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                     [Log('ACCESSLOG'), Log('WARNINGLOG')],
                     ['127.0.0.0/8', '192.168.0.0/16'],
                     {'host.domain': None}, 'private_key', 'certificate')
     vhost_1 = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                     [Log('ACCESSLOG'), Log('WARNINGLOG')],
                     ['127.0.0.0/8', '192.168.0.0/16'],
                     {'host.domain': None}, 'private_key', 'certificate')
     self.assertEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_name('different')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_port(81)
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_protocol('HTTPS')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_doc_root('/var/www')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_sys_root('/var/system')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.add_log(Log('NEWLOG'))
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.add_ip('10.0.0.0/8')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.add_host('newhost', None)
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_private_key('new_key')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_certificate('new certificate')
     self.assertNotEqual(vhost_0, vhost_1)
     self.assertNotEqual(vhost_0, [])
Пример #4
0
 def test_equality(self):
     vhost_0 = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                     [Log('ACCESSLOG'), Log('WARNINGLOG')],
                     ['127.0.0.0/8', '192.168.0.0/16'],
                     {'host.domain': None}, 'private_key', 'certificate')
     vhost_1 = VHost('test vhost', 80, 'HTTP', '/www', '/system',
                     [Log('ACCESSLOG'), Log('WARNINGLOG')],
                     ['127.0.0.0/8', '192.168.0.0/16'],
                     {'host.domain': None}, 'private_key', 'certificate')
     self.assertEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_name('different')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_port(81)
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_protocol('HTTPS')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_doc_root('/var/www')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_sys_root('/var/system')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.add_log(Log('NEWLOG'))
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.add_ip('10.0.0.0/8')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.add_host('newhost', None)
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_private_key('new_key')
     self.assertNotEqual(vhost_0, vhost_1)
     vhost_1 = VHost.from_string(str(vhost_0))
     vhost_1.set_certificate('new certificate')
     self.assertNotEqual(vhost_0, vhost_1)
     self.assertNotEqual(vhost_0, [])