本文整理汇总了Python中flexget.plugins.plugin_rtorrent.RTorrent.torrents方法的典型用法代码示例。如果您正苦于以下问题:Python RTorrent.torrents方法的具体用法?Python RTorrent.torrents怎么用?Python RTorrent.torrents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexget.plugins.plugin_rtorrent.RTorrent
的用法示例。
在下文中一共展示了RTorrent.torrents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_torrents
# 需要导入模块: from flexget.plugins.plugin_rtorrent import RTorrent [as 别名]
# 或者: from flexget.plugins.plugin_rtorrent.RTorrent import torrents [as 别名]
def test_torrents(self, mocked_proxy):
mocked_proxy = mocked_proxy()
hash1 = '09977FE761AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
hash2 = '09977FE761BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'
mocked_proxy.d.multicall.return_value = (
['/data/downloads', 'private.torrent', hash1, 'test_custom1'],
['/data/downloads', 'private.torrent', hash2, 'test_custom2'],
)
client = RTorrent('http://localhost/RPC2')
torrents = client.torrents(fields=['custom1']) # Required fields should be added
assert isinstance(torrents, list)
for torrent in torrents:
assert torrent.get('base_path') == '/data/downloads'
assert torrent.get('name') == 'private.torrent'
if torrent.get('hash') == hash1:
assert torrent.get('custom1') == 'test_custom1'
elif torrent.get('hash') == hash2:
assert torrent.get('custom1') == 'test_custom2'
else:
assert False, 'Invalid hash returned'
assert mocked_proxy.system.multicall.called_with((
['main', 'd.directory_base=', 'd.name=', 'd.hash=', u'd.custom1='],
))