def torrent_info(message): log.info("Handling command info 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: /torren_info [TORRENT_ID]") return torrent_id = args[1] bot.reply_to(message, utils.torrent_info(torrent_id))
def torrent_info(message): log.info("Handling command info 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: /info [TORRENT_ID]") return torrent_id = args[1] bot.reply_to(message, utils.torrent_info(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)