'Testing whether the API creates a request in the AllChannel community when unsubscribing from a channel'

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

    def verify_votecast_made(_):
        self.assertTrue(self.create_votecast_called)
    cid = self.insert_channel_in_db('rand1', 42, 'Test    channel', 'Test    description')
    self.vote_for_channel(cid, int(time.time()))
    expected_json = {'unsubscribed': True}
    self.expected_votecast_cid = 'rand1'
    self.expected_votecast_vote = VOTE_UNSUBSCRIBE
    return self.do_request(('channels/subscribed/%s' % 'rand1'.encode('hex')), expected_code=200, expected_json=expected_json, request_type='DELETE').addCallback(verify_votecast_made)
