# Buggy code
def render_DELETE(self, request):
    """
    .. http:delete:: /channels/discovered/(string: channelid)/torrents/(string: torrent infohash)

    Remove a torrent with a given infohash from a given channel.

        **Example request**:

        .. sourcecode:: none

            curl -X DELETE http://localhost:8085/channels/discovered/abcdefg/torrents/
            97d2d8f5d37e56cfaeaae151d55f05b077074779

        **Example response**:

        .. sourcecode:: javascript

            {
                "removed": True
            }

        :statuscode 404: if the channel is not found or if the torrent is not found in the specified channel
    """
    channel_info = self.get_channel_from_db(self.cid)
    if channel_info is None:
        return ChannelsTorrentsEndpoint.return_404(request)

    torrent_db_columns = [
        "Torrent.torrent_id",
        "infohash",
        "Torrent.name",
        "length",
        "Torrent.category",
        "num_seeders",
        "num_leechers",
        "last_tracker_check",
        "ChannelTorrents.dispersy_id",
    ]
    torrent_info = self.channel_db_handler.getTorrentFromChannelId(
        channel_info[0], self.path.decode("hex"), torrent_db_columns
    )

    if torrent_info is None:
        return BaseChannelsEndpoint.return_404(request, message=UNKNOWN_TORRENT_MSG)

    channel_community = self.get_community_for_channel_id(channel_info[0])
    if channel_community is None:
        return BaseChannelsEndpoint.return_404(request, message=UNKNOWN_COMMUNITY_MSG)

    channel_community.remove_torrents(
        [torrent_info[8]]
    )  # the 8th index is the dispersy id of the channel torrent

    return json.dumps({"removed": True})


# Traceback (AssertionError)
Tuples differ: (2, ('127.0.0.1', [5, 4, 3, 2,... != (2, ('127.0.0.1', [5, 4, 3, 2,...

First differing element 2:
u'None'
''

- (2, ('127.0.0.1', [5, 4, 3, 2, 1]), u'None')
?                                     - ----

+ (2, ('127.0.0.1', [5, 4, 3, 2, 1]), '')
Stacktrace

Traceback (most recent call last):
File "c:\python27\lib\unittest\case.py", line 329, in run
testMethod()
File "C:\workspace\jenkins\workspace\GH_Tribler_PR_tests_win64\tribler\Tribler\Test\test_as_server.py", line 58, in check
result = fun(*argv, **kwargs)
File "C:\workspace\jenkins\workspace\GH_Tribler_PR_tests_win64\tribler\Tribler\Test\Core\Upgrade\test_config_upgrade_70_71.py", line 33, in test_read_test_libtribler_conf
self.assertEqual(result_config.get_anon_proxy_settings(), (2, ("127.0.0.1", [5, 4, 3, 2, 1]), ''))
File "c:\python27\lib\unittest\case.py", line 513, in assertEqual
assertion_func(first, second, msg=msg)
File "c:\python27\lib\unittest\case.py", line 753, in assertTupleEqual
self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple)
File "c:\python27\lib\unittest\case.py", line 724, in assertSequenceEqual
self.fail(msg)
File "c:\python27\lib\unittest\case.py", line 410, in fail
raise self.failureException(msg)
AssertionError: Tuples differ: (2, ('127.0.0.1', [5, 4, 3, 2,... != (2, ('127.0.0.1', [5, 4, 3, 2,...

First differing element 2:
u'None'
''

- (2, ('127.0.0.1', [5, 4, 3, 2, 1]), u'None')
?                                     - ----

+ (2, ('127.0.0.1', [5, 4, 3, 2, 1]), '')

# Fixed code
def render_DELETE(self, request):
    """
    .. http:delete:: /channels/discovered/(string: channelid)/torrents/(string: comma separated torrent infohashes)

    Remove a single or multiple torrents with the given comma separated infohashes from a given channel.

        **Example request**:

        .. sourcecode:: none

            curl -X DELETE http://localhost:8085/channels/discovered/abcdefg/torrents/
            97d2d8f5d37e56cfaeaae151d55f05b077074779,971d55f05b077074779d2d8f5d37e56cfaeaae15

        **Example response**:

        .. sourcecode:: javascript

            {
                "removed": True
            }

        .. sourcecode:: javascript

            {
                "removed": False, "failed_torrents":["97d2d8f5d37e56cfaeaae151d55f05b077074779"]
            }

        :statuscode 404: if the channel is not found
    """
    channel_info = self.get_channel_from_db(self.cid)
    if channel_info is None:
        return ChannelsTorrentsEndpoint.return_404(request)

    channel_community = self.get_community_for_channel_id(channel_info[0])
    if channel_community is None:
        return BaseChannelsEndpoint.return_404(request, message=UNKNOWN_COMMUNITY_MSG)

    torrent_db_columns = [
        "Torrent.torrent_id",
        "infohash",
        "Torrent.name",
        "length",
        "Torrent.category",
        "num_seeders",
        "num_leechers",
        "last_tracker_check",
        "ChannelTorrents.dispersy_id",
    ]

    failed_torrents = []
    for torrent_path in self.path.split(","):
        torrent_info = self.channel_db_handler.getTorrentFromChannelId(
            channel_info[0], torrent_path.decode("hex"), torrent_db_columns
        )
        if torrent_info is None:
            failed_torrents.append(torrent_path)
        else:
            # the 8th index is the dispersy id of the channel torrent
            channel_community.remove_torrents([torrent_info[8]])

    if failed_torrents:
        return json.dumps({"removed": False, "failed_torrents": failed_torrents})

    return json.dumps({"removed": True})