def test_stop(self, mocked_proxy): mocked_proxy = mocked_proxy() mocked_proxy.d.close.return_value = 0 mocked_proxy.d.stop.return_value = 0 client = RTorrent('http://localhost/RPC2') resp = client.stop(torrent_info_hash) assert resp == 0 assert mocked_proxy.d.stop.called_with((torrent_info_hash,)) assert mocked_proxy.d.close.called_with((torrent_info_hash,))