def test_unload_preview(self): """ Test the unloading of the preview community """ def verify_unloaded(_): self.assertEqual(len(self.dispersy.get_communities()), 1) preview_member = DummyMember(self.dispersy, 2, "c" * 20) preview_community = PreviewChannelCommunity(self.dispersy, preview_member, self.member) preview_community.initialize() preview_community.init_timestamp = -500 self.dispersy._communities['c' * 20] = preview_community return self.community.unload_preview().addCallback(verify_unloaded)
def _get_channel_community(self, cid): assert isinstance(cid, str) assert len(cid) == 20 try: return self._dispersy.get_community(cid, True) except KeyError: if __debug__: dprint("join preview community ", cid.encode("HEX")) return PreviewChannelCommunity.join_community(DummyMember(cid), self._my_member, self.integrate_with_tribler)
def _get_channel_community(self, cid): assert isinstance(cid, str) assert len(cid) == 20 try: return self._dispersy.get_community(cid, True) except KeyError: logger.debug("join preview community %s", cid.encode("HEX")) return PreviewChannelCommunity.join_community(self._dispersy, self._dispersy.get_temporary_member_from_id(cid), self._my_member, self.integrate_with_tribler)
def _get_channel_community(self, cid): assert isinstance(cid, str) assert len(cid) == 20 try: return self._dispersy.get_community(cid, True) except CommunityNotFoundException: self._logger.debug(u"join preview community %s", cid.encode("HEX")) return PreviewChannelCommunity.init_community(self._dispersy, self._dispersy.get_member(mid=cid), self._my_member, tribler_session=self.tribler_session)
def _get_channel_community(self, cid): assert isinstance(cid, str) assert len(cid) == 20 try: return self._dispersy.get_community(cid, True) except KeyError: logger.debug("join preview community %s", cid.encode("HEX")) return PreviewChannelCommunity.join_community( self._dispersy, self._dispersy.get_temporary_member_from_id(cid), self._my_member, self.integrate_with_tribler)
def _get_channel_community(self, cid): assert isinstance(cid, str) assert len(cid) == 20 try: return self._dispersy.get_community(cid, True) except CommunityNotFoundException: self._logger.debug(u"join preview community %s", cid.encode("HEX")) return PreviewChannelCommunity.init_community( self._dispersy, self._dispersy.get_member(mid=cid), self._my_member, tribler_session=self.tribler_session)
def _get_channel_community(self, cid): assert isinstance(cid, str) assert len(cid) == 20 try: return self._dispersy.get_community(cid, True) except KeyError: if self.auto_join_channel: if __debug__: dprint("join channel community ", cid.encode("HEX")) return ChannelCommunity.join_community(Member.get_instance(cid, public_key_available=False), self._my_member, self.integrate_with_tribler) else: if __debug__: dprint("join preview community ", cid.encode("HEX")) return PreviewChannelCommunity.join_community(Member.get_instance(cid, public_key_available=False), self._my_member, self.integrate_with_tribler)