本文整理匯總了Python中util.UpnpPunch._communicate_with_igd方法的典型用法代碼示例。如果您正苦於以下問題:Python UpnpPunch._communicate_with_igd方法的具體用法?Python UpnpPunch._communicate_with_igd怎麽用?Python UpnpPunch._communicate_with_igd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類util.UpnpPunch
的用法示例。
在下文中一共展示了UpnpPunch._communicate_with_igd方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_communicate_with_igd_succeed_despite_single_failure
# 需要導入模塊: from util import UpnpPunch [as 別名]
# 或者: from util.UpnpPunch import _communicate_with_igd [as 別名]
def test_communicate_with_igd_succeed_despite_single_failure(
self, mock_orchestrate, mock_get_local_ips):
mock_get_local_ips.return_value = ['192.168.0.12']
mock_orchestrate.side_effect = [upnp.UpnpError, None]
upnp._communicate_with_igd(retries=2)
assert mock_get_local_ips.called
assert mock_orchestrate.called
示例2: test_communicate_with_igd_total_failure
# 需要導入模塊: from util import UpnpPunch [as 別名]
# 或者: from util.UpnpPunch import _communicate_with_igd [as 別名]
def test_communicate_with_igd_total_failure(self, mock_orchestrate,
mock_get_local_ips):
mock_get_local_ips.return_value = ['192.168.0.12']
mock_orchestrate.side_effect = [upnp.UpnpError, upnp.IGDError]
with pytest.raises(upnp.UpnpError):
upnp._communicate_with_igd(retries=2)
assert mock_get_local_ips.called
assert mock_orchestrate.called
示例3: test_communicate_with_igd_success
# 需要導入模塊: from util import UpnpPunch [as 別名]
# 或者: from util.UpnpPunch import _communicate_with_igd [as 別名]
def test_communicate_with_igd_success(self, mock_orchestrate,
mock_get_local_ips):
mock_get_local_ips.return_value = ['192.168.0.12']
upnp._communicate_with_igd()
assert mock_get_local_ips.called
assert mock_orchestrate.called