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