示例#1
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable buddycast and crawler handling
        self.config.set_buddycast(True)
        self.config.set_crawler(True)
示例#2
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())

        # Calculating the infohash for proxyservice.test.torrent
        self.torrentfile = os.path.join('extend_hs_dir',
                                        'proxyservice.test.torrent')

        # Read torrentfile to calculate the infohash
        torrentfile_content = open(self.torrentfile, "rb")
        # Decode all the file
        metainfo = bdecode(torrentfile_content.read())
        # Re-encode only the info section
        self.infohash = hashlib.sha1(bencode(metainfo['info'])).digest()
        # Close the torrentfile
        torrentfile_content.close()

        # Add us as friend, so he will accept the ASK_FOR_HELP
        if False:  # TEMP
            friendsdb = FriendDBHandler.getInstance()
            friendsdb.addFriend(self.mypermid)
        else:
            self.session.set_overlay_request_policy(AllowAllRequestPolicy())

        self.session.set_download_states_callback(self.states_callback)
示例#3
0
    def setUp(self):
        """ override TestAsServer """
        TestAsServer.setUp(self)

        self.session2 = None
        self.seeding_event = threading.Event()
        self.downloading_event = threading.Event()
示例#4
0
 def tearDown(self):
     """ override TestAsServer """
     TestAsServer.tearDown(self)
     try:
         os.remove('randpool.dat')
     except:
         pass
示例#5
0
    def setUp(self):
        """ override TestAsServer """
        TestAsServer.setUp(self)

        self.session2 = None
        self.seeding_event = threading.Event()
        self.downloading_event = threading.Event()
示例#6
0
 def setUpPreSession(self):
     TestAsServer.setUpPreSession(self)
     self.config.set_ipv8_enabled(True)
     self.config.set_ipv8_port(-1)
     self.config.set_libtorrent_enabled(True)
     self.config.set_trustchain_enabled(False)
     self.config.set_tunnel_community_socks5_listen_ports(self.get_socks5_ports())
示例#7
0
    def setUp(self):
        """ override TestAsServer """
        print >> sys.stderr, "test: *** setup friendship"
        TestAsServer.setUp(self)

        self.usercallbackexpected = True
        self.usercallbackreceived = False
示例#8
0
    def setUpPreSession(self):
        TestAsServer.setUpPreSession(self)
        self.config.set_libtorrent(True)

        self.config2 = self.config.copy()
        self.config2.set_state_dir(self.getStateDir(2))
        self.config2.set_listen_port(4810)
 def setUpPreSession(self):
     """ override TestAsServer """
     print >> sys.stderr,"test: Pre Tribler Init"
     TestAsServer.setUpPreSession(self)
     print >> sys.stderr,"test: Pre Tribler Init: config_path",self.config_path
     # Enable social networking
     self.config['rquery'] = 1
示例#10
0
 def tearDown(self):
     """ override TestAsServer """
     TestAsServer.tearDown(self)
     try:
         os.remove('randpool.dat')
     except:
         pass
 def setUpPreSession(self):
     """ override TestAsServer """
     print >> sys.stderr,"test: Pre Tribler Init"
     TestAsServer.setUpPreSession(self)
     print >> sys.stderr,"test: Pre Tribler Init: config_path",self.config_path
     # Enable remote querying
     self.config.set_remote_query(True)
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        # Let Tribler start downloading an non-functioning torrent, so
        # we can talk to a normal download engine.
        
        self.torrentfn = os.path.join('extend_hs_dir','dummydata.merkle.torrent')
        tdef = TorrentDef.load(self.torrentfn)

        dscfg = DownloadStartupConfig()
        dscfg.set_dest_dir(self.config_path)
        
        self.session.start_download(tdef,dscfg)

        # This is the infohash of the torrent in test/extend_hs_dir
        self.infohash = '\xccg\x07\xe2\x9e!]\x16\xae{\xb8\x10?\xf9\xa5\xf9\x07\xfdBk'

        self.setUpMyListenSocket()
        
        # Must be changed in test/extend_hs_dir/dummydata.merkle.torrent as well
        self.mytrackerport = 4901
        # Must be Tribler version <= 3.5.0. Changing this to 351 makes this test
        # fail, so it's a good test.
        self.myid = 'R350-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport,self.myid,'127.0.0.1',self.mylistenport)
        self.mytracker.background_serve()

        print >>sys.stderr,"test: Giving MyTracker and myself time to start"
        time.sleep(5)
示例#13
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable buddycast
     self.config.set_buddycast(True)
     self.config.set_start_recommender(True)
     self.config.set_bartercast(True)
 def setUpPreSession(self):
     """ override TestAsServer """
     print >> sys.stderr, "test: Pre Tribler Init"
     TestAsServer.setUpPreSession(self)
     print >> sys.stderr, "test: Pre Tribler Init: config_path", self.config_path
     # Enable social networking
     self.config['rquery'] = 1
示例#15
0
    def tearDown(self):
        """ override TestAsServer """
        print >> sys.stderr, "test: *** TEARDOWN"
        TestAsServer.tearDown(self)

        for i in range(self.NLISTENERS):
            self.myss[i].close()
 def tearDown(self):
     """ override TestAsServer """
     TestAsServer.tearDown(self)
     try:
         os.remove(self.superpeerfilename)
     except:
         print_exc()
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable buddycast
     self.config.set_buddycast(True)
     self.config.set_start_recommender(True)
     self.config.set_bartercast(True)
示例#18
0
    def setUp(self):
        """ override TestAsServer """
        print >>sys.stderr,"test: *** setup friendship"
        TestAsServer.setUp(self)

        self.usercallbackexpected = True
        self.usercallbackreceived = False
示例#19
0
 def tearDown(self):
     """ override TestAsServer """
     print >> sys.stderr, "test: *** tear down friendship"
     TestAsServer.tearDown(self)
     self.assert_((not self.usercallbackexpected)
                  or (self.usercallbackreceived))
     time.sleep(10)
示例#20
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        # Let Tribler start downloading an non-functioning torrent, so
        # we can talk to a normal download engine.

        self.torrentfn = os.path.join('extend_hs_dir',
                                      'dummydata.merkle.torrent')
        tdef = TorrentDef.load(self.torrentfn)

        dscfg = DownloadStartupConfig()
        dscfg.set_dest_dir(self.config_path)

        self.session.start_download(tdef, dscfg)

        # This is the infohash of the torrent in test/extend_hs_dir
        self.infohash = '\xccg\x07\xe2\x9e!]\x16\xae{\xb8\x10?\xf9\xa5\xf9\x07\xfdBk'

        self.setUpMyListenSocket()

        # Must be changed in test/extend_hs_dir/dummydata.merkle.torrent as well
        self.mytrackerport = 4901
        # Must be Tribler version <= 3.5.0. Changing this to 351 makes this test
        # fail, so it's a good test.
        self.myid = 'R350-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport, self.myid, '127.0.0.1',
                                   self.mylistenport)
        self.mytracker.background_serve()

        print >> sys.stderr, "test: Giving MyTracker and myself time to start"
        time.sleep(5)
示例#21
0
 def setUp(self):
     """ override TestAsServer """
     TestAsServer.setUp(self)
     print >>sys.stderr,"test: Giving Session time to startup"
     time.sleep(5)
     print >>sys.stderr,"test: Session should have started up"
     self.vod_started = False
示例#22
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())
        self.myhash = sha(self.mypermid).digest()

        # Give Tribler some download history
        print >>sys.stderr,"test: Populating MYPREFERENCES table"
        self.myprefdb = self.session.open_dbhandler(NTFY_MYPREFERENCES)
        data = {'destination_path':'.'}
        infohashes = self.create_good_my_prefs(self,btconn.current_version)
        for i in range(0,len(infohashes)):
            commit = (i == len(infohashes)-1)
            self.myprefdb.addMyPreference(infohashes[i], data, commit=commit)

        # Give Tribler some peers
        print >>sys.stderr,"test: Populating PEERS table"
        self.peerdb = self.session.open_dbhandler(NTFY_PEERS)
        past = int(time.time())-1000000000
        peers = self.create_good_random_peers(btconn.current_version,num=200)

        peers = []

        for i in range(0,len(peers)):
            peer = peers[i]
            peer.update({'last_seen':past, 'last_connected':past})
            del peer['connect_time']
            peer['num_torrents'] = peer['nfiles']
            del peer['nfiles']
            commit = (i == len(peers)-1)
            self.peerdb.addPeer(peer['permid'], peer, update_dns=True, update_connected=True, commit=commit)
示例#23
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())  
        
        # Calculating the infohash for proxyservice.test.torrent
        self.torrentfile = os.path.join('extend_hs_dir','proxyservice.test.torrent')
        
        # Read torrentfile to calculate the infohash
        torrentfile_content = open(self.torrentfile, "rb")
        # Decode all the file
        metainfo = bdecode(torrentfile_content.read())
        # Re-encode only the info section
        self.infohash = hashlib.sha1(bencode(metainfo['info'])).digest()
        # Close the torrentfile
        torrentfile_content.close()
        
        # Add us as friend, so he will accept the ASK_FOR_HELP
        if False:  # TEMP
            friendsdb = FriendDBHandler.getInstance()
            friendsdb.addFriend(self.mypermid)
        else:
            self.session.set_overlay_request_policy(AllowAllRequestPolicy())
          
        self.session.set_download_states_callback(self.states_callback)
示例#24
0
 def setUp(self):
     """ override TestAsServer """
     TestAsServer.setUp(self)
     print >>sys.stderr,"test: Giving Session time to startup"
     time.sleep(5)
     print >>sys.stderr,"test: Session should have started up"
     self.vod_started = False
示例#25
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable buddycast and crawler handling
        self.config.set_buddycast(True)
        self.config.set_crawler(True)
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())

        # Create URL compat torrents and save in Torrent database.
        self.tdef1 = TorrentDef.load_from_url(
            P2PURL_SCHEME +
            '://127.2.3.42:7764/announce?SjaakCam.mpegts&k=MHowDQYJKoZIhvcNAQEBBQADaQAwZgJhAN0Khlp5ZhWC7VfLynCkKts71b8h8tZXH87PkDtJUTJaX_SS1Cddxkv63PRmKOvtAHhkTLSsWOZbSeHkOlPIq_FGg2aDLDJ05g3lQ-8mSmo05ff4SLqNUTShWO2CR2TPhQIBAw&l=HCAAAA&s=15&a=RSA&b=AAIAAA'
        )
        self.torrentfn1 = os.path.join(
            self.session.get_torrent_collecting_dir(), "live.torrent")
        self.tdef1.save(self.torrentfn1)

        self.tdef2 = TorrentDef.load_from_url(
            P2PURL_SCHEME +
            '://127.1.0.10:6969/announce?trailer.mkv&r=TTgcifG0Ot7STCY2JL8SUOxROFo&l=AKK35A&s=15&b=AAFnGg'
        )
        self.torrentfn2 = os.path.join(
            self.session.get_torrent_collecting_dir(), "vod.torrent")
        self.tdef2.save(self.torrentfn2)

        self.torrent_db = self.session.open_dbhandler(NTFY_TORRENTS)
        extra_info = {'status': 'good', 'filename': self.torrentfn1}
        self.torrent_db.addExternalTorrent(self.tdef1,
                                           source='',
                                           extra_info=extra_info)
        extra_info = {'status': 'good', 'filename': self.torrentfn2}
        self.torrent_db.addExternalTorrent(self.tdef2,
                                           source='',
                                           extra_info=extra_info)
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())
        self.myhash = sha(self.mypermid).digest()
    def tearDown(self):
        """ override TestAsServer """
        print >> sys.stderr,"test: *** TEARDOWN"
        TestAsServer.tearDown(self)

        for i in range(self.NLISTENERS):
            self.myss[i].close()
示例#29
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        self.config.set_swift_proc(True)
        self.config.set_torrent_collecting(True)
        self.config.set_mainline_dht(True)

        self.config.set_swift_tunnel_listen_port(
            self.config.get_listen_port() + 2)
        self.config.set_swift_dht_listen_port(self.config.get_listen_port() +
                                              3)
        self.config.set_swift_tunnel_httpgw_listen_port(
            self.config.get_listen_port() + 4)
        self.config.set_swift_tunnel_cmdgw_listen_port(
            self.config.get_listen_port() + 5)
        self.config.set_mainline_dht_listen_port(
            self.config.get_listen_port() + 6)

        self.config2 = self.config.copy()  # not really necess
        self.config2.set_state_dir(self.getStateDir(2))
        self.config2.set_listen_port(self.config.get_listen_port() + 10)
        self.config2.set_swift_tunnel_listen_port(
            self.config2.get_listen_port() + 2)
        self.config2.set_swift_dht_listen_port(self.config2.get_listen_port() +
                                               3)
        self.config2.set_swift_tunnel_httpgw_listen_port(
            self.config2.get_listen_port() + 4)
        self.config2.set_swift_tunnel_cmdgw_listen_port(
            self.config2.get_listen_port() + 5)
        self.config2.set_mainline_dht_listen_port(
            self.config2.get_listen_port() + 6)
示例#30
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())        
        self.myhash = sha(self.mypermid).digest()
示例#31
0
 def setUpPreSession(self):
     """ override TestAsServer """
     print >> sys.stderr,"test: Pre Tribler Init"
     TestAsServer.setUpPreSession(self)
     print >> sys.stderr,"test: Pre Tribler Init: config_path",self.config_path
     # Enable remote querying
     self.config.set_remote_query(True)
示例#32
0
 def tearDown(self):
     """ override TestAsServer """
     TestAsServer.tearDown(self)
     try:
         os.remove(self.superpeerfilename)
     except:
         print_exc()
示例#33
0
    def setUpPreSession(self):
        TestAsServer.setUpPreSession(self)
        self.config.set_libtorrent(True)

        self.config2 = self.config.copy()
        self.config2.set_state_dir(self.getStateDir(2))
        self.config2.set_listen_port(4810)
示例#34
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())        

        self.setUpMyListenSocket()
示例#35
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.config.set_overlay(False)
        self.config.set_internal_tracker(True)

        self.mylistenport = 4810
 def setUpPreSession(self):
     TestAsServer.setUpPreSession(self)
     self.config.set_dispersy_enabled(True)
     self.config.set_libtorrent_enabled(False)
     self.config.set_video_server_enabled(False)
     self.config.set_trustchain_enabled(False)
     self.config.set_tunnel_community_enabled(False)
     self.config.set_market_community_enabled(False)
示例#37
0
    def setUp(self):
        """ override TestAsServer """
        TestAsServer.setUp(self)

        self.session2 = Session(self.config2, ignore_singleton=True)
        self.session2.start()

        self.seeding_event = threading.Event()
示例#38
0
    def setUp(self):
        """ override TestAsServer """
        TestAsServer.setUp(self)

        self.session2 = Session(self.config2, ignore_singleton=True)
        self.session2.start()

        self.seeding_event = threading.Event()
示例#39
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     
     self.config.set_overlay(False)
     self.config.set_internal_tracker(True)
     
     self.mylistenport = 4810
示例#40
0
 def setUpPreSession(self):
     TestAsServer.setUpPreSession(self)
     self.config.set_ipv8_enabled(True)
     self.config.set_ipv8_port(-1)
     self.config.set_libtorrent_enabled(True)
     self.config.set_trustchain_enabled(False)
     self.config.set_tunnel_community_socks5_listen_ports(
         self.get_socks5_ports())
示例#41
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())

        self.setUpMyListenSocket()
示例#42
0
    def setUp(self):
        """ unittest test setup code """
        TestAsServer.setUp(self)
        self.port = self.session.get_videoplayer_port()
        self.sourcefn = os.path.join(TESTS_DATA_DIR, "video.avi")
        self.sourcesize = os.path.getsize(self.sourcefn)

        # wait 5s to allow server to start
        time.sleep(5)
示例#43
0
    def setUp(self):
        """ unittest test setup code """
        TestAsServer.setUp(self)
        self.port = self.session.get_videoplayer_port()
        self.sourcefn = os.path.join(TESTS_DATA_DIR, "video.avi")
        self.sourcesize = os.path.getsize(self.sourcefn)

        # wait 5s to allow server to start
        time.sleep(5)
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.config.set_megacache(False)
        self.config.set_internal_tracker(True)
        #self.config.set_tracker_nat_check(0)

        self.mylistenport = 4810
示例#45
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.config.set_megacache(False)
        self.config.set_internal_tracker(True)
        #self.config.set_tracker_nat_check(0)

        self.mylistenport = 4810
    def setUpPreSession(self):
        """ override TestAsServer """
        print >> sys.stderr,"test: Pre Tribler Init"
        TestAsServer.setUpPreSession(self)
        print >> sys.stderr,"test: Pre Tribler Init: config_path",self.config_path
        # Enable dialback support
        self.config.set_dialback(True)
        self.config.set_buddycast(True) # make sure overlay connections are being made
        self.config.set_start_recommender(True)

        # Write superpeers.txt
        self.install_path = tempfile.mkdtemp()
        spdir = os.path.join(self.install_path, LIBRARYNAME, 'Core')
        os.makedirs(spdir)

        statsdir = os.path.join(self.install_path, LIBRARYNAME, 'Core', 'Statistics')
        os.makedirs(statsdir)
        
        superpeerfilename = os.path.join(spdir, 'superpeer.txt')
        print >> sys.stderr,"test: writing",self.NLISTENERS,"superpeers to",superpeerfilename
        f = open(superpeerfilename, "w")

        self.mylistenport = []
        self.myss = []
        self.mykeypairs = []
        self.mypermids = []
        for i in range(self.NLISTENERS):
            # Start our server side, to with Tribler will try to connect
            self.mylistenport.append(4810+i)
            self.myss.append(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
            self.myss[i].setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            self.myss[i].bind(('', self.mylistenport[i]))
            self.myss[i].listen(1)

            self.mykeypairs.append(EC.gen_params(EC.NID_sect233k1))
            self.mykeypairs[i].gen_key()
            self.mypermids.append(str(self.mykeypairs[i].pub().get_der()))

            content = '127.0.0.1, '+str(self.mylistenport[i])+', '+show_permid(self.mypermids[i])+', FakeSuperPeer\n'
            f.write(content)
        f.close()
        
        self.config.set_install_dir(self.install_path)
        
        srcfiles = []
        srcfiles.append(os.path.join(LIBRARYNAME,"schema_sdb_v"+str(CURRENT_MAIN_DB_VERSION)+".sql"))
        srcfiles.append(os.path.join(LIBRARYNAME,"Core","Statistics","tribler_seedingstats_sdb.sql"))
        srcfiles.append(os.path.join(LIBRARYNAME,"Core","Statistics","tribler_friendship_stats_sdb.sql"))
        srcfiles.append(os.path.join(LIBRARYNAME,"Core","Statistics","tribler_videoplayback_stats.sql"))
        for srcfile in srcfiles:
            sfn = os.path.join('..','..',srcfile)
            dfn = os.path.join(self.install_path,srcfile)
            print >>sys.stderr,"test: copying",sfn,dfn
            shutil.copyfile(sfn,dfn)

        """
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable dialback
        self.config.set_dialback(True)
        # H4X0R: testing only
        self.config.sessconfig['dialback_active'] = 0

        self.setUpMyListenSocket()
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())        
        self.myhash = sha(self.mypermid).digest()
        
        self.buddycast = BuddyCastFactory.getInstance(superpeer=True)
        self.buddycast.olthread_register(True)
示例#49
0
    def setUpPostSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPostSession(self)

        self.mypermid = str(self.my_keypair.pub().get_der())
        self.hispermid = str(self.his_keypair.pub().get_der())
        self.myhash = sha(self.mypermid).digest()

        self.buddycast = BuddyCastFactory.getInstance(superpeer=True)
        self.buddycast.olthread_register(True)
示例#50
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable dialback
        self.config.set_dialback(True)
        # H4X0R: testing only
        self.config.sessconfig['dialback_active'] = 0

        self.setUpMyListenSocket()
示例#51
0
 def setUpPreSession(self):
     TestAsServer.setUpPreSession(self)
     self.config.set_dispersy(True)
     self.config.set_torrent_store(True)
     self.config.set_enable_torrent_search(True)
     self.config.set_enable_channel_search(True)
     self.config.set_channel_community_enabled(True)
     self.config.set_preview_channel_community_enabled(True)
     self.config.set_torrent_collecting(True)
     self.config.set_torrent_checking(True)
     self.config.set_megacache(True)
示例#52
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        self.config.set_libtorrent(True)

        self.config2 = self.config.copy()  # not really necess
        self.config2.set_state_dir(self.getStateDir(2))
        self.config2.set_listen_port(4810)

        self.dscfg2 = DownloadStartupConfig()
        self.dscfg2.set_dest_dir(self.getDestDir(2))
示例#53
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        self.config.set_libtorrent(True)

        self.config2 = self.config.copy()  # not really necess
        self.config2.set_state_dir(self.getStateDir(2))
        self.config2.set_listen_port(4810)

        self.dscfg2 = DownloadStartupConfig()
        self.dscfg2.set_dest_dir(self.getDestDir(2))
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # BuddyCast
        self.config.set_buddycast(True)
        self.config.set_start_recommender(True)

        fd, self.superpeerfilename = tempfile.mkstemp()
        os.write(fd, '')
        os.close(fd)
        self.config.set_superpeer_file(self.superpeerfilename)
示例#55
0
    def setUpPreSession(self):
        TestAsServer.setUpPreSession(self)

        # Enable all communities
        config_sections = ['trustchain', 'tunnel_community', 'ipv8', 'dht', 'chant', 'market_community']

        for section in config_sections:
            self.config.config[section]['enabled'] = True

        self.config.set_tunnel_community_socks5_listen_ports(self.get_socks5_ports())
        self.config.set_ipv8_bootstrap_override("127.0.0.1:12345")  # So we do not contact the real trackers
示例#56
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # BuddyCast
        self.config.set_buddycast(True)
        self.config.set_start_recommender(True)

        fd,self.superpeerfilename = tempfile.mkstemp()
        os.write(fd,'')
        os.close(fd)
        self.config.set_superpeer_file(self.superpeerfilename)
示例#57
0
 def setUpPreSession(self):
     TestAsServer.setUpPreSession(self)
     self.config.set_dispersy_enabled(True)
     self.config.set_torrent_store_enabled(True)
     self.config.set_torrent_search_enabled(True)
     self.config.set_channel_search_enabled(True)
     self.config.set_metadata_enabled(True)
     self.config.set_channel_community_enabled(True)
     self.config.set_preview_channel_community_enabled(True)
     self.config.set_torrent_collecting_enabled(True)
     self.config.set_torrent_checking_enabled(True)
     self.config.set_megacache_enabled(True)
示例#58
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # Enable social networking
        self.config.set_social_networking(True)

        # Give him a usericon to send
        fn = self.make_filename('usericon-ok.jpg')
        f = open(fn,"rb")
        data = f.read()
        f.close()
        self.config.set_mugshot(data,'image/jpeg')
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # Enable social networking
        self.config.set_social_networking(True)

        # Give him a usericon to send
        fn = self.make_filename('usericon-ok.jpg')
        f = open(fn, "rb")
        data = f.read()
        f.close()
        self.config.set_mugshot(data, 'image/jpeg')
示例#60
0
    def setUpPreSession(self):
        TestAsServer.setUpPreSession(self)

        # Enable all communities
        config_sections = ['search_community', 'trustchain', 'allchannel_community', 'channel_community',
                           'preview_channel_community', 'tunnel_community', 'dispersy', 'ipv8', 'dht']

        for section in config_sections:
            self.config.config[section]['enabled'] = True

        self.config.set_megacache_enabled(True)
        self.config.set_tunnel_community_socks5_listen_ports(self.get_socks5_ports())
        self.config.set_ipv8_bootstrap_override("127.0.0.1:12345")