'Testing whether the API returns error 409 when subscribing to an already subscribed channel'

@deferred(timeout=10)
def test_subscribe_channel_already_subscribed(self):

    cid = self.insert_channel_in_db('rand1', 42, 'Test    channel', 'Test    description')
    self.vote_for_channel(cid, int(time.time()))
    expected_json = {'error': ALREADY_SUBSCRIBED_RESPONSE_MSG}
    return self.do_request(('channels/subscribed/%s' % 'rand1'.encode('hex')), expected_code=409, expected_json=expected_json, request_type='PUT')
