def setUp(self): self.pool = getPool() dbfile = DvPath(conn["dbName"]) if not dbfile.IsFile(): dbfile.CreateDirectories() self.checkdb() self.connect()
def app_db(modules=None): a = ApplicationBase() a.Register(appconf) if modules: for m in modules: a.Register(m) p = Portal() p.Register(a, "nive") a.SetupApplication() dbfile = DvPath(a.dbConfiguration.dbName) if not dbfile.IsFile(): dbfile.CreateDirectories() root = DvPath(a.dbConfiguration.fileRoot) if not root.IsDirectory(): root.CreateDirectories() try: a.Query("select id from pool_meta where id=1") a.Query("select id from data1 where id=1") a.Query("select id from data2 where id=1") a.Query("select id from data3 where id=1") a.Query("select id from pool_files where id=1") a.Query("select id from pool_sys where id=1") a.Query("select id from pool_groups where id=1") a.Query("select title from pool_meta where id=1") except: a.GetTool("nive.tools.dbStructureUpdater")() # disable this to update test tables each time the tests are called #a.GetTool("nive.tools.dbStructureUpdater")() a.Startup(None) # this will reset all testdata #emptypool(a) return a
def setUp(self): dbfile = DvPath(conn["dbName"]) if not dbfile.IsFile(): dbfile.CreateDirectories() checkdb() db = Sqlite3(conf, conn) db.GetPoolStructureObj().SetStructure(struct) self.pool = db
def setUp(self): conn = DatabaseConf(DB_CONF) p = Sqlite3(connParam=conn, **test_Base.conf) p.structure.Init(structure=test_Base.struct, stdMeta=test_Base.struct[u"pool_meta"]) dbfile = DvPath(conn["dbName"]) if not dbfile.IsFile(): dbfile.CreateDirectories() self.pool = p self.pool.connection.connect()
def delete(self): if not self.path: return True originalPath = DvPath(self._Path()) if not originalPath.IsFile(): #not a file return True if originalPath.Exists() and not self.fileentry().pool._MoveToTrashcan(originalPath, self.fileentry().id): #Delete failed! return False return True
def test_Get(self): n = self.name p = DvPath(n) self.assert_(p.GetPath() == self.base) self.assert_(p.GetName() == "nofile") self.assert_(p.GetExtension() == "txt") self.assert_(p.GetNameExtension() == "nofile.txt") self.assert_(p.GetSize() == -1) self.assert_(p.GetLastDirectory() == "tmp_nivepathtest_000") p.IsFile() p.IsDirectory() p.Exists() p.IsValid()
def app(confs=[]): a = WebsitePublisher() a.Register(appconf) a.Register(dbconf) for c in confs: a.Register(c) p = Portal() p.Register(a) a.Startup(None) dbfile = DvPath(a.dbConfiguration.dbName) if not dbfile.IsFile(): dbfile.CreateDirectories() try: a.Query("select id from pool_meta where id=1") a.Query("select id from data1 where id=1") a.Query("select id from data2 where id=1") a.Query("select id from data3 where id=1") a.Query("select id from pool_files where id=1") except: a.GetTool("nive.components.tools.dbStructureUpdater")() return a
def __test(): dbfile = DvPath(conn["dbName"]) if not dbfile.IsFile(): dbfile.CreateDirectories() checkdb() db = Sqlite3(conf, conn) db.GetPoolStructureObj().SetStructure(struct) app = Sqlite3ConnMultithreading() app.pool = db app.setUp() threadcnt = 10 ts = [] for i in range(threadcnt): t = ThreadClass() ts.append(t) t.app = app t.start() for t in ts: t.join() print "OK"
def app_db(confs=None): a = DataStorage() a.Register(appconf) if confs: for c in confs: a.Register(c) p = Portal() p.Register(a) a.Startup(None) dbfile = DvPath(a.dbConfiguration.dbName) if not dbfile.IsFile(): dbfile.CreateDirectories() try: a.Query("select id from pool_meta where id=1") a.Query("select pool_wfp from pool_meta where id=1") a.Query("select id from bookmarks where id=1") a.Query("select id from tracks where id=1") a.Query("select id from pool_files where id=1") except: a.GetTool("nive.tools.dbStructureUpdater")() return a
def app(extmodules=None): appconf = AppConf("nive.userdb.app") appconf.modules.append("nive.userdb.userview.view") appconf.modules.append("nive.components.tools.sendMail") a = UserDB(appconf) a.dbConfiguration = dbconf p = Portal() p.Register(a) a.Startup(None) dbfile = DvPath(a.dbConfiguration.dbName) if not dbfile.IsFile(): dbfile.CreateDirectories() try: a.Query("select id from pool_meta where id=1") a.Query("select id from data1 where id=1") a.Query("select id from data2 where id=1") a.Query("select id from data3 where id=1") a.Query("select id from pool_files where id=1") except: a.GetTool("nive.components.tools.dbStructureUpdater")() return a
def app_db(confs=None): appconf = AppConf("nive_cms.app") a = WebsitePublisher() a.Register(appconf) if confs: for c in confs: a.Register(c) p = Portal() p.Register(a) a.Startup(None) dbfile = DvPath(a.dbConfiguration.dbName) if not dbfile.IsFile(): dbfile.CreateDirectories() try: a.Query("select id from pool_meta where id=1") a.Query("select id from box where id=1") a.Query("select id from columnbox where id=1") a.Query("select id from texts where id=1") a.Query("select id from pool_files where id=1") except: a.GetTool("nive.tools.dbStructureUpdater")() return a
def app_db(confs=None): appconf = AppConf("nive_userdb.app") appconf.modules.append("nive_userdb.userview.view") appconf.modules.append("nive.tools.sendMailTester") a = UserDB() a.Register(appconf) if confs: for c in confs: a.Register(c) p = Portal() p.Register(a) a.Startup(None) dbfile = DvPath(a.dbConfiguration.dbName) if not dbfile.IsFile(): dbfile.CreateDirectories() try: a.Query("select id from pool_meta where id=1") a.Query("select id from users where id=1") a.Query("select id from users where token='1'") a.Query("select id from users where tempcache='1'") a.Query("select id from pool_files where id=1") except: a.GetTool("nive.tools.dbStructureUpdater")() return a