Пример #1
0
    def test_torrent_queue_bottom(self):
        with client_env(self.track("torrent_queue_bottom_a"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_bottom_b"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
        self.assertEqual(torrent_a.queue_position, 0)
        with client_env(self.track("torrent_queue_bottom_c"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_2, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_bottom_d"), self.live_test):
            torrent_b = self.client.torrent_status(self.torrent2.info_hash)
        self.assertEqual(torrent_b.queue_position, 1)

        with client_env(self.track("torrent_queue_bottom_e"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_3, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_bottom_f"), self.live_test):
            torrent_c = self.client.torrent_status(self.torrent3.info_hash)
        self.assertEqual(torrent_c.queue_position, 2)

        with client_env(self.track("torrent_queue_bottom_g"), self.live_test):
            self.assertTrue(self.client.torrent_queue_bottom(self.torrent.info_hash))

        with client_env(self.track("torrent_queue_bottom_h"), self.live_test):
            torrent_c = self.client.torrent_status(self.torrent3.info_hash)
            self.assertEqual(torrent_c.queue_position, 1)

        with client_env(self.track("torrent_queue_bottom_i"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
            self.assertEqual(torrent_a.queue_position, 2)

        with client_env(self.track("torrent_queue_bottom_j"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent2.info_hash)
            self.assertEqual(torrent_a.queue_position, 0)
Пример #2
0
    def test_torrent_queue_bottom(self):
        with client_env(self.track("torrent_queue_bottom_a"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_bottom_b"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
        self.assertEqual(torrent_a.queue_position, 0)
        with client_env(self.track("torrent_queue_bottom_c"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_2, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_bottom_d"), self.live_test):
            torrent_b = self.client.torrent_status(self.torrent2.info_hash)
        self.assertEqual(torrent_b.queue_position, 1)

        with client_env(self.track("torrent_queue_bottom_e"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_3, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_bottom_f"), self.live_test):
            torrent_c = self.client.torrent_status(self.torrent3.info_hash)
        self.assertEqual(torrent_c.queue_position, 2)

        with client_env(self.track("torrent_queue_bottom_g"), self.live_test):
            self.assertTrue(self.client.torrent_queue_bottom(self.torrent.info_hash))

        with client_env(self.track("torrent_queue_bottom_h"), self.live_test):
            torrent_c = self.client.torrent_status(self.torrent3.info_hash)
            self.assertEqual(torrent_c.queue_position, 1)

        with client_env(self.track("torrent_queue_bottom_i"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
            self.assertEqual(torrent_a.queue_position, 2)

        with client_env(self.track("torrent_queue_bottom_j"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent2.info_hash)
            self.assertEqual(torrent_a.queue_position, 0)
Пример #3
0
 def test_torrent_status(self):
     with client_env(self.track("torrent_status_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     self.sleep_live(5)
     with client_env(self.track("torrent_status_b"), self.live_test):
         status = self.client.torrent_status(self.torrent.info_hash)
     self.assertTrue(status)
Пример #4
0
 def test_torrent_status(self):
     with client_env(self.track("torrent_status_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     self.sleep_live(5)
     with client_env(self.track("torrent_status_b"), self.live_test):
         status = self.client.torrent_status(self.torrent.info_hash)
     self.assertTrue(status)
Пример #5
0
 def test_torrent_pause(self):
     with client_env(self.track("torrent_pause_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_pause_b"), self.live_test):
         torrent_a = self.client.torrent_status(self.torrent.info_hash)
         self.assertIn(torrent_a.state, [TorrentState.PAUSED, TorrentState.CHECKING, TorrentState.DOWNLOADING])
     with client_env(self.track("torrent_pause_c"), self.live_test):
         self.assertTrue(self.client.torrent_pause(self.torrent.info_hash))
Пример #6
0
 def test_torrent_peers(self):
     with client_env(self.track("torrent_peers_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     self.sleep_live(10)
     with client_env(self.track("torrent_peers_b"), self.live_test):
         peers = self.client.torrent_peers(self.torrent.info_hash)
     self.assertTrue(len(peers) > 0)
     self.assertSetEqual({"client", "down_speed", "ip", "progress", "up_speed", "country"}, set(peers[0].keys()))
Пример #7
0
 def test_torrent_peers(self):
     with client_env(self.track("torrent_peers_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     self.sleep_live(10)
     with client_env(self.track("torrent_peers_b"), self.live_test):
         peers = self.client.torrent_peers(self.torrent.info_hash)
     self.assertTrue(len(peers) > 0)
     self.assertSetEqual({'client', 'down_speed', 'ip', 'progress', 'up_speed', 'country'}, set(peers[0].keys()))
Пример #8
0
 def test_torrent_pause(self):
     with client_env(self.track("torrent_pause_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_pause_b"), self.live_test):
         torrent_a = self.client.torrent_status(self.torrent.info_hash)
         self.assertIn(torrent_a.state, [TorrentState.PAUSED, TorrentState.CHECKING, TorrentState.DOWNLOADING])
     with client_env(self.track("torrent_pause_c"), self.live_test):
         self.assertTrue(self.client.torrent_pause(self.torrent.info_hash))
Пример #9
0
 def test_torrent_reannounce(self):
     with client_env(self.track("torrent_reannounce_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_reannounce_b"), self.live_test):
         torrent_a = self.client.torrent_status(self.torrent.info_hash)
         self.assertEqual(torrent_a.next_announce, 0)
     time.sleep(5)
     with client_env(self.track("torrent_reannounce_c"), self.live_test):
         self.client.torrent_reannounce(self.torrent.info_hash)
     with client_env(self.track("torrent_reannounce_d"), self.live_test):
         torrent_a = self.client.torrent_status(self.torrent.info_hash)
         self.assertGreater(torrent_a.next_announce, 0)
Пример #10
0
 def test_torrent_reannounce(self):
     with client_env(self.track("torrent_reannounce_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_reannounce_b"), self.live_test):
         torrent_a = self.client.torrent_status(self.torrent.info_hash)
         self.assertEqual(torrent_a.next_announce, 0)
     time.sleep(5)
     with client_env(self.track("torrent_reannounce_c"), self.live_test):
         self.client.torrent_reannounce(self.torrent.info_hash)
     with client_env(self.track("torrent_reannounce_d"), self.live_test):
         torrent_a = self.client.torrent_status(self.torrent.info_hash)
         self.assertGreater(torrent_a.next_announce, 0)
Пример #11
0
 def test_torrent_start(self):
     with client_env(self.track("torrent_start_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     time.sleep(2)
     with client_env(self.track("torrent_start_b"), self.live_test):
         self.assertTrue(self.client.torrent_pause(self.torrent.info_hash))
     time.sleep(2)
     with client_env(self.track("torrent_start_c"), self.live_test):
         status = self.client.torrent_status(self.torrent.info_hash)
         self.assertEqual(status.state, TorrentState.PAUSED)
     time.sleep(2)
     with client_env(self.track("torrent_start_d"), self.live_test):
         self.assertTrue(self.client.torrent_start(self.torrent.info_hash))
     time.sleep(2)
     with client_env(self.track("torrent_start_e"), self.live_test):
         status = self.client.torrent_status(self.torrent.info_hash)
         self.assertIn(status.state, [TorrentState.STARTED, TorrentState.DOWNLOADING])
Пример #12
0
 def test_torrent_start(self):
     with client_env(self.track("torrent_start_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     time.sleep(2)
     with client_env(self.track("torrent_start_b"), self.live_test):
         self.assertTrue(self.client.torrent_pause(self.torrent.info_hash))
     time.sleep(2)
     with client_env(self.track("torrent_start_c"), self.live_test):
         status = self.client.torrent_status(self.torrent.info_hash)
         self.assertEqual(status.state, TorrentState.PAUSED)
     time.sleep(2)
     with client_env(self.track("torrent_start_d"), self.live_test):
         self.assertTrue(self.client.torrent_start(self.torrent.info_hash))
     time.sleep(2)
     with client_env(self.track("torrent_start_e"), self.live_test):
         status = self.client.torrent_status(self.torrent.info_hash)
         self.assertIn(status.state, [TorrentState.STARTED, TorrentState.DOWNLOADING])
Пример #13
0
    def test_torrent_queue_up(self):
        with client_env(self.track("torrent_queue_up_a"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_up_b"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
        self.assertEqual(torrent_a.queue_position, 0)
        with client_env(self.track("torrent_queue_up_c"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_2, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_up_d"), self.live_test):
            torrent_b = self.client.torrent_status(self.torrent2.info_hash)
        self.assertEqual(torrent_b.queue_position, 1)

        with client_env(self.track("torrent_queue_up_e"), self.live_test):
            self.client.torrent_queue_up(self.torrent2.info_hash)
        with client_env(self.track("torrent_queue_up_f"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
        self.assertEqual(torrent_a.queue_position, 1)
        with client_env(self.track("torrent_queue_up_g"), self.live_test):
            torrent_b = self.client.torrent_status(self.torrent2.info_hash)
        self.assertEqual(torrent_b.queue_position, 0)
Пример #14
0
    def test_torrent_queue_up(self):
        with client_env(self.track("torrent_queue_up_a"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_up_b"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
        self.assertEqual(torrent_a.queue_position, 0)
        with client_env(self.track("torrent_queue_up_c"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_2, "rb").read(), tempfile.gettempdir()))
        with client_env(self.track("torrent_queue_up_d"), self.live_test):
            torrent_b = self.client.torrent_status(self.torrent2.info_hash)
        self.assertEqual(torrent_b.queue_position, 1)

        with client_env(self.track("torrent_queue_up_e"), self.live_test):
            self.client.torrent_queue_up(self.torrent2.info_hash)
        with client_env(self.track("torrent_queue_up_f"), self.live_test):
            torrent_a = self.client.torrent_status(self.torrent.info_hash)
        self.assertEqual(torrent_a.queue_position, 1)
        with client_env(self.track("torrent_queue_up_g"), self.live_test):
            torrent_b = self.client.torrent_status(self.torrent2.info_hash)
        self.assertEqual(torrent_b.queue_position, 0)
Пример #15
0
 def test_torrent_recheck(self):
     # Not sure best way to check this..
     with client_env(self.track("torrent_recheck_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_recheck_b"), self.live_test):
         self.assertTrue(self.client.torrent_recheck(self.torrent.info_hash))
Пример #16
0
 def test_torrent_speed(self):
     with client_env(self.track("torrent_speed_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_speed_b"), self.live_test):
         speed = self.client.torrent_speed(self.torrent.info_hash)
     self.assertTrue(speed)
Пример #17
0
    def test_torrent_add_duplicate(self):
        with client_env(self.track("torrent_add_duplicate_a"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))

        with client_env(self.track("torrent_add_duplicate_b"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
Пример #18
0
 def test_current_speeds(self):
     with client_env(self.track("torrent_current_speeds"), self.live_test):
         speed = self.client.current_speeds()
     self.assertTrue(len(speed) == 2)
     self.assertGreaterEqual(speed[0], 0)
     self.assertGreaterEqual(speed[1], 0)
Пример #19
0
 def test_client_version(self):
     with client_env(self.track("torrent_version"), self.live_test):
         ver = self.client.client_version()
     num, rev = ver.split(" ")
     self.assertTrue(float(int(rev[1:][:-1])) > 2)
     self.assertTrue(rev > 10000)
Пример #20
0
 def test_client_version(self):
     with client_env(self.track("torrent_version"), self.live_test):
         ver = self.client.client_version()
     num, rev = ver.split(" ")
     self.assertTrue(float(int(rev[1:][:-1])) > 2)
     self.assertTrue(rev > 10000)
Пример #21
0
    def test_torrent_add_duplicate(self):
        with client_env(self.track("torrent_add_duplicate_a"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))

        with client_env(self.track("torrent_add_duplicate_b"), self.live_test):
            self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
Пример #22
0
 def test_current_speeds(self):
     with client_env(self.track("torrent_current_speeds"), self.live_test):
         speed = self.client.current_speeds()
     self.assertTrue(len(speed) == 2)
     self.assertGreaterEqual(speed[0], 0)
     self.assertGreaterEqual(speed[1], 0)
Пример #23
0
 def test_torrent_speed(self):
     with client_env(self.track("torrent_speed_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_speed_b"), self.live_test):
         speed = self.client.torrent_speed(self.torrent.info_hash)
     self.assertTrue(speed)
Пример #24
0
 def test_torrent_recheck(self):
     # Not sure best way to check this..
     with client_env(self.track("torrent_recheck_a"), self.live_test):
         self.assertTrue(self.client.torrent_add(open(self.test_file_1, "rb").read(), tempfile.gettempdir()))
     with client_env(self.track("torrent_recheck_b"), self.live_test):
         self.assertTrue(self.client.torrent_recheck(self.torrent.info_hash))