本文整理汇总了Python中txtorcon.TCPHiddenServiceEndpoint.private_tor方法的典型用法代码示例。如果您正苦于以下问题:Python TCPHiddenServiceEndpoint.private_tor方法的具体用法?Python TCPHiddenServiceEndpoint.private_tor怎么用?Python TCPHiddenServiceEndpoint.private_tor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.TCPHiddenServiceEndpoint
的用法示例。
在下文中一共展示了TCPHiddenServiceEndpoint.private_tor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_endpoint_properties
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_endpoint_properties(self):
ep = yield TCPHiddenServiceEndpoint.private_tor(Mock(), 80)
self.assertEqual(None, ep.onion_private_key)
self.assertEqual(None, ep.onion_uri)
ep.hiddenservice = Mock()
ep.hiddenservice.private_key = 'mumble'
self.assertEqual('mumble', ep.onion_private_key)
示例2: test_private_tor
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_private_tor(self):
m = Mock()
from txtorcon import endpoints
endpoints.launch_tor = m
ep = yield TCPHiddenServiceEndpoint.private_tor(Mock(), 80,
control_port=1234)
self.assertTrue(m.called)
示例3: test_private_tor_no_control_port
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_private_tor_no_control_port(self):
m = Mock()
from txtorcon import endpoints
endpoints.launch_tor = m
ep = yield TCPHiddenServiceEndpoint.private_tor(Mock(), 80)
m.assert_called()
示例4: test_hiddenservice_key_unfound
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_hiddenservice_key_unfound(self):
ep = TCPHiddenServiceEndpoint.private_tor(self.reactor, 1234, hidden_service_dir="/dev/null")
# FIXME Mock() should work somehow for this, but I couldn't
# make it "go"
class Blam(object):
@property
def private_key(self):
raise IOError("blam")
ep.hiddenservice = Blam()
self.assertEqual(ep.onion_private_key, None)
return ep
示例5: test_progress_updates_private_tor
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_progress_updates_private_tor(self, tor):
ep = TCPHiddenServiceEndpoint.private_tor(self.reactor, 1234)
tor.call_args[1]['progress_updates'](40, 'FOO', 'foo to the bar')
return ep
示例6: test_progress_updates_private_tor
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_progress_updates_private_tor(self, ftb):
with patch('txtorcon.endpoints.launch_tor') as tor:
ep = TCPHiddenServiceEndpoint.private_tor(self.reactor, 1234)
self.assertEqual(len(tor.mock_calls), 1)
tor.call_args[1]['progress_updates'](40, 'FOO', 'foo to the bar')
return ep
示例7: test_private_tor_no_control_port
# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import private_tor [as 别名]
def test_private_tor_no_control_port(self, ftb):
m = Mock()
from txtorcon import endpoints
endpoints.launch_tor = m
yield TCPHiddenServiceEndpoint.private_tor(Mock(), 80)
self.assertTrue(m.called)