本文整理匯總了Python中flexget.plugins.plugin_rtorrent.RTorrent.torrent方法的典型用法代碼示例。如果您正苦於以下問題:Python RTorrent.torrent方法的具體用法?Python RTorrent.torrent怎麽用?Python RTorrent.torrent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flexget.plugins.plugin_rtorrent.RTorrent
的用法示例。
在下文中一共展示了RTorrent.torrent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_torrent
# 需要導入模塊: from flexget.plugins.plugin_rtorrent import RTorrent [as 別名]
# 或者: from flexget.plugins.plugin_rtorrent.RTorrent import torrent [as 別名]
def test_torrent(self, mocked_proxy):
mocked_proxy = mocked_proxy()
mocked_proxy.system.multicall.return_value = [
['/data/downloads'], ['private.torrent'], [torrent_info_hash], ['test_custom1'], [123456]
]
client = RTorrent('http://localhost/RPC2')
torrent = client.torrent(torrent_info_hash, fields=['custom1', 'down_rate']) # Required fields should be added
assert isinstance(torrent, dict)
assert torrent.get('base_path') == '/data/downloads'
assert torrent.get('hash') == torrent_info_hash
assert torrent.get('custom1') == 'test_custom1'
assert torrent.get('name') == 'private.torrent'
assert torrent.get('down_rate') == 123456
assert mocked_proxy.system.multicall.called_with(([
{'params': (torrent_info_hash,), 'methodName': 'd.base_path'},
{'params': (torrent_info_hash,), 'methodName': 'd.name'},
{'params': (torrent_info_hash,), 'methodName': 'd.hash'},
{'params': (torrent_info_hash,), 'methodName': 'd.custom1'},
{'params': (torrent_info_hash,), 'methodName': 'd.down.rate'},
]))