def torrent_remove(message): log.info("Handling command remove torrent - %s" % message.text) args = message.text.split() if len(args) < 2: log.warn("Missing torrent ID") bot.reply_to(message, "Missing torrent ID. Usage: /torrent_remove [TORRENT_ID]") return torrent_id = args[1] bot.reply_to(message, utils.torrent_remove(torrent_id))
def torrent_remove(message): log.info("Handling command remove torrent - %s" % message.text) args = message.text.split() if len(args) < 2: log.warning("Missing torrent ID") bot.reply_to(message, "Missing torrent ID. Usage: /remove [TORRENT_ID]") return torrent_id = args[1] bot.reply_to(message, utils.torrent_remove(torrent_id))
def test_add_list_info_and_remove(self): count_before = len(utils.torrent_list()) self.assertEqual(utils.torrent_add(TORRENT_MAGNET), TRANSMISSION_MSG_SUCCESS) self.assertEqual(utils.torrent_add(TORRENT_MAGNET), 'Error: duplicate torrent') torrents = utils.torrent_list() count_after = len(torrents) added_torrent = torrents[-1] self.assertTrue(utils.torrent_info(added_torrent.id)) self.assertEqual(count_after, count_before + 1) self.assertEqual(utils.torrent_remove(added_torrent.id), TRANSMISSION_MSG_SUCCESS)
def test_torrent_remove_invalid(self): self.assertEqual(utils.torrent_remove(-1), TRANSMISSION_MSG_SUCCESS)