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 app_nodb(): appconf = AppConf("nive_cms.app") a = WebsitePublisher() a.Register(appconf) a.Register(DatabaseConf()) p = Portal() p.Register(a) #a.Startup(None) return a
def app_nodb(): appconf = AppConf("nive_userdb.app") appconf.modules.append("nive_userdb.userview.view") appconf.modules.append("nive.tools.sendMail") a = UserDB(appconf) a.dbConfiguration = DatabaseConf() p = Portal() p.Register(a) a.Startup(None) return a
def SetupApplication(self): """ Loads self.configuration, includes modules and updates meta fields. """ if not self.configuration: raise ConfigurationError, "Configuration is empty" c = self.configuration # special values if c.get("id") and not self.__name__: self.__name__ = c.id if c.get("acl"): self.__acl__ = tuple(c.acl) if c.get("dbConfiguration"): # bw 0.9.3 if type(c.dbConfiguration) == DictType: self.dbConfiguration = DatabaseConf(**c.dbConfiguration) else: self.dbConfiguration = c.dbConfiguration
def setUp(self): p = MySql(connParam=DatabaseConf(MYSQL_CONF), **test_Base.conf) p.structure.Init(structure=test_Base.struct, stdMeta=test_Base.struct[u"pool_meta"]) self.pool = p self.pool.connection.connect()
def _loadApp(self, mods=None): if not mods: mods = [] mods.append(DatabaseConf(POSTGRES_CONF)) self.app = db_app.app_db(mods)
# real database test configuration # change these to fit your system WIN = sys.platform.startswith("win") # sqlite and mysql if WIN: ROOT = "c:\\Temp\\nive\\" else: ROOT = "/var/tmp/nive/" DB_CONF = DatabaseConf( dbName = ROOT+"nive.db", fileRoot = ROOT, context = "Sqlite3" ) MYSQL_CONF = DatabaseConf( context = "MySql", dbName = "ut_nive", host = "localhost", user = "******", password = "", port = "", fileRoot = ROOT )
from types import UnicodeType from nive.definitions import DatabaseConf from nive.utils.dataPool2.base import * from nive.utils.dataPool2.sqlite3Pool import Sqlite3 from nive.utils.path import DvPath from sqlite3 import OperationalError from nive.tests.db_app import app_db from test_Base import conf, stdMeta, struct, SystemFlds, Fulltext, Files, data1_1, data2_1, meta1, file1_1, file1_2 from nive.tests import __local # configuration --------------------------------------------------------------------------- conn = DatabaseConf(dbName=__local.ROOT + "nive.db") def getPool(): p = Sqlite3(connParam=conn, **conf) p.structure.Init(structure=struct, stdMeta=struct[u"pool_meta"]) return p countdb = 1 class dbTest(object): def tearDown(self): self.pool.Close()
from nive.utils.dataPool2.mySqlPool import * uTestCase = unittest.TestCase from nive.definitions import DatabaseConf from nive.utils.dataPool2.base import * from nive.utils.path import DvPath from test_db import dbTest from test_Base import conf, stdMeta, struct, SystemFlds, Fulltext, Files, data1_1, data2_1, meta1, file1_1, file1_2 from nive.tests import __local conn = DatabaseConf(user=__local.USER, password=__local.PASSWORD, host=__local.HOST, port=__local.PORT, dbName=__local.DATABASE, unicode=1, timeout=1) myconn = conn def getPool(): p = MySql(connParam=myconn, **conf) p.structure.Init(structure=struct, stdMeta=struct[u"pool_meta"]) return p class MySqlTest(dbTest, uTestCase): """ """