def test_remove_torrent_call_exception(self, deluge_client): rpc_client = deluge_client.return_value rpc_client.connected = True rpc_client.call.side_effect = Exception plugin = DelugeClientPlugin() settings = { 'host': 'localhost', 'username': '******', 'password': '******' } plugin.set_settings(settings) torrent_hash = 'SomeRandomHashMockString' with pytest.raises(Exception) as e: plugin.remove_torrent(torrent_hash) rpc_client.call.assert_called_once_with('core.remove_torrent', torrent_hash.lower(), False)
def test_remove_torrent_without_credentials(self, deluge_client): rpc_client = deluge_client.return_value rpc_client.connected = True plugin = DelugeClientPlugin() rpc_client.call.return_value = True torrent_hash = 'SomeRandomHashMockString' self.assertFalse(plugin.remove_torrent(torrent_hash)) rpc_client.call.assert_not_called()
def test_remove_torrent_call_exception(self, deluge_client): rpc_client = deluge_client.return_value rpc_client.connected = True rpc_client.call.side_effect = Exception plugin = DelugeClientPlugin() settings = {'host': 'localhost', 'username': '******', 'password': '******'} plugin.set_settings(settings) torrent_hash = 'SomeRandomHashMockString' self.assertFalse(plugin.remove_torrent(torrent_hash)) rpc_client.call.assert_called_once_with('core.remove_torrent', torrent_hash.lower(), False)
def test_remove_torrent_call_exception(self, deluge_client): rpc_client = deluge_client.return_value rpc_client.connected = True rpc_client.call.side_effect = Exception plugin = DelugeClientPlugin() settings = {"host": "localhost", "username": "******", "password": "******"} plugin.set_settings(settings) torrent_hash = "SomeRandomHashMockString" self.assertFalse(plugin.remove_torrent(torrent_hash)) rpc_client.call.assert_called_once_with("core.remove_torrent", torrent_hash.lower(), False)
def test_remove_torrent(self, deluge_client): rpc_client = deluge_client.return_value rpc_client.connected = True plugin = DelugeClientPlugin() settings = {'host': 'localhost', 'username': '******', 'password': '******'} plugin.set_settings(settings) rpc_client.call.return_value = True torrent_hash = 'SomeRandomHashMockString' self.assertTrue(plugin.remove_torrent(torrent_hash)) rpc_client.call.assert_called_once_with('core.remove_torrent', torrent_hash.lower(), False)