def test_remove_torrent_without_credentials(self, transmission_client): rpc_client = transmission_client.return_value plugin = TransmissionClientPlugin() torrent_hash = 'SomeRandomHashMockString' self.assertFalse(plugin.remove_torrent(torrent_hash)) rpc_client.remove_torrent.assert_not_called()
def test_remove_torrent_remove_torrent_exception(self, transmission_client): rpc_client = transmission_client.return_value rpc_client.remove_torrent.side_effect = transmissionrpc.TransmissionError plugin = TransmissionClientPlugin() settings = { 'host': 'localhost', 'username': '******', 'password': '******' } plugin.set_settings(settings) torrent_hash = 'SomeRandomHashMockString' with pytest.raises(transmissionrpc.TransmissionError) as e: plugin.remove_torrent(torrent_hash) rpc_client.remove_torrent.assert_called_once_with(torrent_hash.lower(), delete_data=False)
def test_remove_torrent(self, transmission_client): rpc_client = transmission_client.return_value plugin = TransmissionClientPlugin() settings = {'host': 'localhost', 'username': '******', 'password': '******'} plugin.set_settings(settings) torrent_hash = 'SomeRandomHashMockString' self.assertTrue(plugin.remove_torrent(torrent_hash)) rpc_client.remove_torrent.assert_called_once_with(torrent_hash.lower(), delete_data=False)