def setUp(self): self.config = testing.setUp() self.config.include('pyramid_mailer.testing') #DBSession.remove() #DBSession = _initTestingDB() my_settings = { 'sqlalchemy.url': 'sqlite:///test_webtest.db', # the database 'available_languages': 'de en', 'speedfunding.dashboard_number': 20, } from speedfunding import main #try: app = main({}, **my_settings) from sqlalchemy import create_engine engine = create_engine('sqlite:///test_webtest.db') DBSession.configure(bind=engine) from speedfunding.models import Base Base.metadata.create_all(engine) _populate_testDB() #import pdb; pdb.set_trace() #except: # app = main({}, **my_other_settings) # pass from webtest import TestApp self.testapp = TestApp(app)
def setUp(self): self.config = testing.setUp() from sqlalchemy import create_engine engine = create_engine('sqlite://') from speedfunding.models import ( Base, #Speedfundings, #Group, #C3sStaff, #TheTotal ) DBSession.configure(bind=engine) Base.metadata.create_all(engine) self.initialize_db()
def setUp(self): self.config = testing.setUp() from sqlalchemy import create_engine engine = create_engine('sqlite:///test_utils.db') from speedfunding.models import ( Base, ) DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: model1 = Speedfundings( # english firstname=u'first', lastname=u'last', email=u'*****@*****.**', address1=u'some', address2=u'where', postcode=u'98765', city=u'over', country=u'some country', locale=u'en', donation=u'3', shirt_size=u'3', comment=u'some comment.', ) DBSession.add(model1) DBSession.flush() with transaction.manager: model2 = Speedfundings( # german firstname=u'first', lastname=u'last', email=u'*****@*****.**', address1=u'some', address2=u'where', postcode=u'98765', city=u'over', country=u'some country', locale=u'de', donation=u'3', shirt_size=u'3', comment=u'some comment.', ) DBSession.add(model2) DBSession.flush()
def setUp(self): self.config = testing.setUp() from sqlalchemy import create_engine engine = create_engine('sqlite:///tests.db') from speedfunding.models import ( Base, Speedfundings, TheTotal, ) DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: model = Speedfundings( firstname=u'first', lastname=u'last', email=u'*****@*****.**', address1=u'some', address2=u'where', postcode=u'98765', city=u'over', country=u'CC', locale=u'AT', donation=u'', shirt_size=u'', comment=u'some comment.', ) DBSession.add(model) # a total with transaction.manager: a_total = TheTotal( amount_actual=u'4200', amount_promised=u'5000', #time='2013-11-20', num_shirts=u'0' ) #try: DBSession.add(a_total) DBSession.flush()