# Buggy code
def render_GET(self, _):
    """
    .. http:get:: /channels/subscribed

    Returns all the channels the user is subscribed to.

        **Example request**:

        .. sourcecode:: none

            curl -X GET http://localhost:8085/channels/subscribed

        **Example response**:

        .. sourcecode:: javascript

            {
                "subscribed": [{
                    "id": 3,
                    "dispersy_cid": "da69aaad39ccf468aba2ab9177d5f8d8160135e6",
                    "name": "My fancy channel",
                    "description": "A description of this fancy channel",
                    "subscribed": True,
                    "votes": 23,
                    "torrents": 3,
                    "spam": 5,
                    "modified": 14598395,
                    "can_edit": True,
                }, ...]
            }
    """
    subscribed_channels_db = self.channel_db_handler.getMySubscribedChannels(
        include_dispersy=True
    )
    results_json = [
        convert_db_channel_to_json(channel) for channel in subscribed_channels_db
    ]
    return json.dumps({"subscribed": results_json})


# 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_GET(self, request):
    """
    .. http:get:: /channels/subscribed/(string: channelid)

    Shows the status of subscription to a specific channel along with number of existing votes in the channel

        **Example request**:

        .. sourcecode:: none

            curl -X GET http://localhost:8085/channels/subscribed/da69aaad39ccf468aba2ab9177d5f8d8160135e6

        **Example response**:

        .. sourcecode:: javascript

            {
                "subscribed" : True, "votes": 111
            }
    """
    request.setHeader("Content-Type", "text/json")
    channel_info = self.get_channel_from_db(self.cid)

    if channel_info is None:
        return ChannelsModifySubscriptionEndpoint.return_404(request)

    response = dict()
    response["subscribed"] = channel_info[7] == VOTE_SUBSCRIBE
    response["votes"] = channel_info[5]

    return json.dumps(response)