Example #1
0
    def setUp(self):
        yield super(AbstractTorrentUpgrade63to64, self).setUp()

        self.torrent_collecting_dir = os.path.join(self.session_base_dir,
                                                   "torrent_collecting")
        self.sqlite_path = os.path.join(self.session_base_dir, "sqlite")
        os.mkdir(self.torrent_collecting_dir)
        os.mkdir(os.path.join(self.torrent_collecting_dir, "test_dir"))
        os.mkdir(self.sqlite_path)

        # write and create files
        self.write_data_to_file(
            os.path.join(self.session_base_dir, "upgradingdb.txt"))
        self.write_data_to_file(
            os.path.join(self.torrent_collecting_dir, "test1.mbinmap"))
        self.write_data_to_file(
            os.path.join(self.torrent_collecting_dir, "test2.mhash"))
        self.write_data_to_file(
            os.path.join(self.torrent_collecting_dir, "tmp_test3"))
        self.write_data_to_file(
            os.path.join(self.torrent_collecting_dir, "torrent1.torrent"))
        self.write_data_to_file(
            os.path.join(self.torrent_collecting_dir, "torrent2.torrent"))
        os.mkdir(os.path.join(self.torrent_collecting_dir, "swift_reseeds"))
        shutil.copyfile(
            TORRENT_FILE,
            os.path.join(self.torrent_collecting_dir, "torrent3.torrent"))
        shutil.copyfile(
            os.path.join(self.DB_DATA_DIR, "torrent_upgrade_64_dispersy.db"),
            os.path.join(self.sqlite_path, "dispersy.db"))

        self.torrent_upgrader = TorrentMigrator64(self.torrent_collecting_dir,
                                                  self.session_base_dir)
Example #2
0
 def test_upgrade_temp_torrent_dir_is_file(self):
     self.write_data_to_file(
         os.path.join(self.session_base_dir, ".tmp_migration_v64"))
     self.torrent_upgrader = TorrentMigrator64(self.torrent_collecting_dir,
                                               self.session_base_dir)
     self.torrent_upgrader.start_migrate()
Example #3
0
 def test_upgrade_no_valid_torrent_collecting_dir(self):
     self.torrent_upgrader = TorrentMigrator64(
         os.path.join(self.torrent_collecting_dir, "bla"),
         self.session_base_dir)
     self.torrent_upgrader.start_migrate()