예제 #1
0
 def add_random_torrent(self, metadata_cls, name="test"):
     torrent_metadata = metadata_cls.from_dict({
         "infohash": random_infohash(),
         "title": name,
         "tags": "",
         "size": 1234,
         "status": NEW
     })
     torrent_metadata.sign()
예제 #2
0
 def add_random_torrent(self, metadata_cls, name="test"):
     torrent_metadata = metadata_cls.from_dict({
         "infohash": random_infohash(),
         "title": name,
         "tags": "",
         "size": 1234,
         "status": NEW
     })
     torrent_metadata.sign()
예제 #3
0
    def setUp(self):
        yield super(BaseTestMetadataEndpoint, self).setUp()
        self.infohashes = []

        torrents_per_channel = 5
        # Add a few channels
        with db_session:
            for ind in xrange(10):
                self.session.lm.mds.ChannelNode._my_key = default_eccrypto.generate_key(
                    'curve25519')
                _ = self.session.lm.mds.ChannelMetadata(
                    title='channel%d' % ind,
                    subscribed=(ind % 2 == 0),
                    num_entries=torrents_per_channel,
                    infohash=random_infohash())
                for torrent_ind in xrange(torrents_per_channel):
                    rand_infohash = random_infohash()
                    self.infohashes.append(rand_infohash)
                    _ = self.session.lm.mds.TorrentMetadata(
                        title='torrent%d' % torrent_ind,
                        infohash=rand_infohash)
예제 #4
0
    def setup_torrents(self):
        for _ in range(10):
            infohash = random_infohash()
            name = random_utf8_string()
            length = random.randint(1000, 9999)
            num_files = random.randint(1, 10)
            category_list = ['video', 'audio']
            creation_date = random.randint(1000000, 111111111)
            seeders = random.randint(10, 200)
            leechers = random.randint(5, 1000)
            cid = random_string(size=20)

            self.sample_torrents.append([infohash, name, length, num_files, category_list, creation_date,
                                         seeders, leechers, cid])
예제 #5
0
    def setUp(self):
        yield super(BaseTestMetadataEndpoint, self).setUp()
        self.infohashes = []

        torrents_per_channel = 5
        # Add a few channels
        with db_session:
            for ind in xrange(10):
                self.session.lm.mds.ChannelNode._my_key = default_eccrypto.generate_key('curve25519')
                _ = self.session.lm.mds.ChannelMetadata(title='channel%d' % ind, subscribed=(ind % 2 == 0),
                                                        num_entries=torrents_per_channel, infohash=random_infohash())
                for torrent_ind in xrange(torrents_per_channel):
                    rand_infohash = random_infohash()
                    self.infohashes.append(rand_infohash)
                    _ = self.session.lm.mds.TorrentMetadata(title='torrent%d' % torrent_ind, infohash=rand_infohash)
예제 #6
0
    def setup_torrents(self):
        for _ in range(10):
            infohash = random_infohash()
            name = random_utf8_string()
            length = random.randint(1000, 9999)
            num_files = random.randint(1, 10)
            category_list = ['video', 'audio']
            creation_date = random.randint(1000000, 111111111)
            seeders = random.randint(10, 200)
            leechers = random.randint(5, 1000)
            cid = random_string(size=20)

            self.sample_torrents.append([
                infohash, name, length, num_files, category_list,
                creation_date, seeders, leechers, cid
            ])
예제 #7
0
 def test_infohash(self):
     test_infohash = random_infohash()
     self.assertIsNotNone(test_infohash)
     self.assertTrue(isinstance(test_infohash, str))
     self.assertEqual(len(test_infohash), 20)