def make(): file_manager = FileManager(self.transient_root, self.persistent_root, self.transient_url, self.persistent_url) filesessionmaker(orm.sessionmaker(), self.file_manager, file_managers={ ObjWithFile.file: file_manager, })
def setUp(self): self.transient_root = tempfile.mkdtemp() self.persistent_root = tempfile.mkdtemp() self.transient_url = '/transient/' self.persistent_url = '/media/' self.file_manager = FileManager(self.transient_root, self.persistent_root, self.transient_url, self.persistent_url) Session = filesessionmaker(orm.sessionmaker(), self.file_manager) engine = create_engine('sqlite://') Base.metadata.create_all(engine) self.db = Session(bind=engine)
def setUp(self): self.transient_root = tempfile.mkdtemp() self.persistent_root = tempfile.mkdtemp() self.transient_url = '/transient/' self.persistent_url = '/media/' self.file_manager = FileManager(self.transient_root, self.persistent_root, self.transient_url, self.persistent_url) self.metadata_transient_root = tempfile.mkdtemp() self.metadata_persistent_root = tempfile.mkdtemp() self.metadata_transient_url = '/metadata/transient/' self.metadata_persistent_url = '/metadata/media/' self.metadata_file_manager = FileManager(self.metadata_transient_root, self.metadata_persistent_root, self.metadata_transient_url, self.metadata_persistent_url) self.model_transient_root = tempfile.mkdtemp() self.model_persistent_root = tempfile.mkdtemp() self.model_transient_url = '/model/transient/' self.model_persistent_url = '/model/media/' self.model_file_manager = FileManager(self.model_transient_root, self.model_persistent_root, self.model_transient_url, self.model_persistent_url) Session = filesessionmaker(orm.sessionmaker(), self.file_manager, file_managers={ MetadataLevelObj.metadata: self.metadata_file_manager, ModelLevelObj: self.model_file_manager, }) engine = create_engine('sqlite://') Base.metadata.create_all(engine) CustomBase.metadata.create_all(engine) self.db = Session(bind=engine)