'Testing whether an error is returned when we subscribe to a channel and an error pops up'

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

    def mocked_vote(*_):
        return fail(Failure(RuntimeError('error')))
    mod_sub_endpoint = ChannelsModifySubscriptionEndpoint(self.session, '')
    mod_sub_endpoint.vote_for_channel = mocked_vote
    subscribed_endpoint = self.session.lm.api_manager.root_endpoint.children['channels'].children['subscribed']
    subscribed_endpoint.getChild = (lambda *_: mod_sub_endpoint)
    self.should_check_equality = False
    return self.do_request('channels/subscribed/', expected_code=500, request_type='PUT')
