class PostgresTestCase(PostgresContentsManagerTestCase):

    def setUp(self):
        self.crypto = make_fernet()
        self._pgmanager = PostgresContentsManager(
            user_id='test',
            db_url=TEST_DB_URL,
            crypto=self.crypto,
        )
        self._pgmanager.ensure_user()
        self._pgmanager.ensure_root_directory()

        self.contents_manager = HybridContentsManager(
            managers={'': self._pgmanager}
        )

    # HybridContentsManager is not expected to dispatch calls to get_file_id
    # because PostgresContentsManager is the only contents manager that
    # implements it.
    def test_get_file_id(self):
        pass

    def set_pgmgr_attribute(self, name, value):
        setattr(self._pgmanager, name, value)

    def make_dir(self, api_path):
        self.contents_manager.new(
            model={'type': 'directory'},
            path=api_path,
        )
Example #2
0
class PostgresTestCase(PostgresContentsManagerTestCase):
    def setUp(self):
        self.crypto = make_fernet()
        self._pgmanager = PostgresContentsManager(
            user_id='test',
            db_url=TEST_DB_URL,
            crypto=self.crypto,
        )
        self._pgmanager.ensure_user()
        self._pgmanager.ensure_root_directory()

        self.contents_manager = HybridContentsManager(
            managers={'': self._pgmanager})

    # HybridContentsManager is not expected to dispatch calls to get_file_id
    # because PostgresContentsManager is the only contents manager that
    # implements it.
    def test_get_file_id(self):
        pass

    def set_pgmgr_attribute(self, name, value):
        setattr(self._pgmanager, name, value)

    def make_dir(self, api_path):
        self.contents_manager.new(
            model={'type': 'directory'},
            path=api_path,
        )
class PostgresTestCase(PostgresContentsManagerTestCase):

    def setUp(self):

        drop_testing_db_tables()
        migrate_testing_db()

        self._pgmanager = PostgresContentsManager(
            user_id='test',
            db_url=TEST_DB_URL,
        )
        self._pgmanager.ensure_user()
        self._pgmanager.ensure_root_directory()

        self.contents_manager = HybridContentsManager(
            managers={'': self._pgmanager}
        )

    def set_pgmgr_attribute(self, name, value):
        setattr(self._pgmanager, name, value)

    def tearDown(self):
        drop_testing_db_tables()
        migrate_testing_db()

    def make_dir(self, api_path):
        self.contents_manager.new(
            model={'type': 'directory'},
            path=api_path,
        )
    def setUp(self):
        self._pgmanager = PostgresContentsManager(
            user_id='test',
            db_url=TEST_DB_URL,
        )
        self._pgmanager.ensure_user()
        self._pgmanager.ensure_root_directory()

        self.contents_manager = HybridContentsManager(
            managers={'': self._pgmanager})
Example #5
0
    def setUp(self):
        self.crypto = make_fernet()
        self._pgmanager = PostgresContentsManager(
            user_id='test',
            db_url=TEST_DB_URL,
            crypto=self.crypto,
        )
        self._pgmanager.ensure_user()
        self._pgmanager.ensure_root_directory()

        self.contents_manager = HybridContentsManager(
            managers={'': self._pgmanager})

        self.addCleanup(self._pgmanager.engine.dispose)
        self.addCleanup(self._pgmanager.checkpoints.engine.dispose)
Example #6
0
 def setUp(self):
     self._temp_dir = TemporaryDirectory()
     self.td = self._temp_dir.name
     self._file_manager = FileContentsManager(root_dir=self.td,
                                              delete_to_trash=False)
     self.contents_manager = HybridContentsManager(
         managers={'': self._file_manager})
    def setUp(self):
        self._pgmanager = PostgresContentsManager(
            user_id='test',
            db_url=TEST_DB_URL,
        )
        self._pgmanager.ensure_user()
        self._pgmanager.ensure_root_directory()

        self.contents_manager = HybridContentsManager(
            managers={'': self._pgmanager}
        )
Example #8
0
    def setUp(self):

        mgr_roots = ['A', '', u'unicodé']
        self.temp_dirs = {prefix: TemporaryDirectory() for prefix in mgr_roots}
        self.temp_dir_names = {
            prefix: v.name
            for prefix, v in iteritems(self.temp_dirs)
        }
        self._managers = {
            prefix: FileContentsManager(root_dir=self.temp_dir_names[prefix])
            for prefix in mgr_roots
        }
        self.contents_manager = HybridContentsManager(managers=self._managers)