当前位置: 首页>>代码示例>>Python>>正文


Python VHost.add_ip方法代码示例

本文整理汇总了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())
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:19,代码来源:vhost_test.py

示例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, [])
开发者ID:rupinder,项目名称:GNU-MyServer-GSoC,代码行数:43,代码来源:vhost_test.py


注:本文中的vhost.VHost.add_ip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。