本文整理汇总了Python中vhost.VHost.add_ip方法的典型用法代码示例。如果您正苦于以下问题:Python VHost.add_ip方法的具体用法?Python VHost.add_ip怎么用?Python VHost.add_ip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vhost.VHost
的用法示例。
在下文中一共展示了VHost.add_ip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ip
# 需要导入模块: from vhost import VHost [as 别名]
# 或者: from vhost.VHost import add_ip [as 别名]
def test_ip(self):
vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system',
[Log('ACCESSLOG')])
self.assertEqual(set(), vhost.get_ip())
vhost.add_ip('10.0.0.0/8')
vhost.add_ip('192.168.0.0/16')
self.assertEqual(set(['10.0.0.0/8', '192.168.0.0/16']), vhost.get_ip())
vhost.remove_ip('10.0.0.0/8')
self.assertEqual(set(['192.168.0.0/16']), vhost.get_ip())
vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system',
[Log('ACCESSLOG'), Log('WARNINGLOG')],
['127.0.0.0/8', '192.168.0.0/16'])
self.assertEqual(set(['127.0.0.0/8', '192.168.0.0/16']), vhost.get_ip())
vhost = VHost('test vhost', 80, 'HTTP', '/www', '/system',
[Log('ACCESSLOG'), Log('WARNINGLOG')],
ip = ['127.0.0.0/8', '192.168.0.0/16'])
self.assertEqual(set(['127.0.0.0/8', '192.168.0.0/16']), vhost.get_ip())
示例2: test_equality
# 需要导入模块: from vhost import VHost [as 别名]
# 或者: from vhost.VHost import add_ip [as 别名]
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, [])