'The startup method of this class creates a fake Dispersy instance with a fake AllChannel community. It also
inserts some random channels so we have some data to work with.'

def setUp(self, autoload_discovery=True):

    super(TestChannelsSubscriptionEndpoint, self).setUp(autoload_discovery)
    self.expected_votecast_cid = None
    self.expected_votecast_vote = None
    self.create_votecast_called = False
    fake_community = self.create_fake_allchannel_community()
    fake_community.disp_create_votecast = self.on_dispersy_create_votecast
    self.session.config.get_dispersy_enabled = (lambda : True)
    self.session.lm.dispersy = Dispersy(ManualEnpoint(0), self.getStateDir())
    self.session.lm.dispersy.attach_community(fake_community)
    for i in xrange(0, 10):
        self.insert_channel_in_db(('rand%d' % i), (42 + i), ('Test    channel    %d' % i), ('Test    description    %d' % i))
