def setup(self): from kotti import main settings = {'sqlalchemy.url': testing_db_url(), 'kotti.secret': 'dude'} with patch('kotti.resources.initialize_sql'): main({}, **settings)
def setUpFunctional(global_config=None, **settings): from kotti import main import wsgi_intercept.zope_testbrowser from webtest import TestApp tearDown() _settings = { 'sqlalchemy.url': testing_db_url(), 'kotti.secret': 'secret', 'kotti.site_title': 'Test Splash Page', # for mailing 'kotti.populators': 'kotti.testing._populator\nkotti_splashpage.populate', 'mail.default_sender': 'kotti@localhost', 'kotti.includes': 'kotti_splashpage' } _settings.update(settings) host, port = BASE_URL.split(':')[-2:] app = main({}, **_settings) wsgi_intercept.add_wsgi_intercept(host[2:], int(port), lambda: app) Browser = wsgi_intercept.zope_testbrowser.WSGI_Browser return dict( Browser=Browser, browser=Browser(), test_app=TestApp(app), )
def setUp(self, **kwargs): self.settings = { 'kotti.configurators': 'kotti_software.kotti_configure', 'sqlalchemy.url': testing_db_url(), 'kotti.secret': 'dude', 'kotti_software.collection_settings.pagesize': '5' } super(FunctionalTests, self).setUp(**self.settings)
def unresolved_settings(custom_settings): from kotti import conf_defaults from kotti.testing import testing_db_url settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' settings['sqlalchemy.url'] = testing_db_url() settings.update(custom_settings) return settings
def unresolved_settings(custom_settings): from kotti import conf_defaults from kotti.testing import testing_db_url settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' settings['sqlalchemy.url'] = testing_db_url() settings.update(custom_settings) return settings
def unresolved_settings(custom_settings): from kotti import conf_defaults from kotti.testing import testing_db_url settings = conf_defaults.copy() settings["kotti.secret"] = "secret" settings["kotti.secret2"] = "secret2" settings["kotti.populators"] = "kotti.testing._populator" settings["sqlalchemy.url"] = testing_db_url() settings.update(custom_settings) return settings
def unresolved_settings(custom_settings): from kotti import conf_defaults from kotti.testing import testing_db_url settings = conf_defaults.copy() settings["kotti.secret"] = "secret" settings["kotti.secret2"] = "secret2" settings["kotti.populators"] = "kotti.testing._populator" settings["sqlalchemy.url"] = testing_db_url() settings.update(custom_settings) return settings
def connection(): # the following setup is based on `kotti.resources.initialize_sql`, # except that it explicitly binds the session to a specific connection # enabling us to use savepoints independent from the orm, thus allowing # to `rollback` after using `transaction.commit`... from sqlalchemy import create_engine from kotti.testing import testing_db_url from kotti import metadata, DBSession engine = create_engine(testing_db_url()) connection = engine.connect() DBSession.registry.clear() DBSession.configure(bind=connection) metadata.bind = engine return connection
def connection(): """ sets up a SQLAlchemy engine and returns a connection to the database. The connection string used for testing can be specified via the `KOTTI_TEST_DB_STRING` environment variable. """ # the following setup is based on `kotti.resources.initialize_sql`, # except that it explicitly binds the session to a specific connection # enabling us to use savepoints independent from the orm, thus allowing # to `rollback` after using `transaction.commit`... from sqlalchemy import create_engine from kotti.testing import testing_db_url from kotti import metadata, DBSession engine = create_engine(testing_db_url()) connection = engine.connect() DBSession.registry.clear() DBSession.configure(bind=connection) metadata.bind = engine return connection
def connection(): """ sets up a SQLAlchemy engine and returns a connection to the database. The connection string used for testing can be specified via the `KOTTI_TEST_DB_STRING` environment variable. """ # the following setup is based on `kotti.resources.initialize_sql`, # except that it explicitly binds the session to a specific connection # enabling us to use savepoints independent from the orm, thus allowing # to `rollback` after using `transaction.commit`... from sqlalchemy import create_engine from kotti.testing import testing_db_url from kotti import metadata, DBSession engine = create_engine(testing_db_url()) connection = engine.connect() DBSession.registry.clear() DBSession.configure(bind=connection) metadata.bind = engine return connection
def tnc_connection(): # the following setup is based on `kotti.resources.initialize_sql`, # except that it explicitly binds the session to a specific connection # enabling us to use savepoints independent from the orm, thus allowing # to `rollback` after using `transaction.commit`... from transaction import commit from sqlalchemy import create_engine from kotti.testing import testing_db_url from kotti import metadata, DBSession engine = create_engine(testing_db_url()) connection = engine.connect() DBSession.registry.clear() DBSession.configure(bind=connection) metadata.bind = engine metadata.drop_all(engine) metadata.create_all(engine) for populate in tnc_settings()['kotti.populators']: populate() commit() return connection
def connection(custom_settings): """ sets up a SQLAlchemy engine and returns a connection to the database. The connection string used for testing can be specified via the ``KOTTI_TEST_DB_STRING`` environment variable. The ``custom_settings`` fixture is needed to allow users to import their models easily instead of having to override the ``connection``. """ # the following setup is based on `kotti.resources.initialize_sql`, # except that it explicitly binds the session to a specific connection # enabling us to use savepoints independent from the orm, thus allowing # to `rollback` after using `transaction.commit`... from sqlalchemy import create_engine from kotti import DBSession from kotti import metadata from kotti.resources import _adjust_for_engine from kotti.testing import testing_db_url engine = create_engine(testing_db_url()) _adjust_for_engine(engine) connection = engine.connect() DBSession.registry.clear() DBSession.configure(bind=connection) metadata.bind = engine return connection
def connection(custom_settings): """ sets up a SQLAlchemy engine and returns a connection to the database. The connection string used for testing can be specified via the ``KOTTI_TEST_DB_STRING`` environment variable. The ``custom_settings`` fixture is needed to allow users to import their models easily instead of having to override the ``connection``. """ # the following setup is based on `kotti.resources.initialize_sql`, # except that it explicitly binds the session to a specific connection # enabling us to use savepoints independent from the orm, thus allowing # to `rollback` after using `transaction.commit`... from sqlalchemy import create_engine from kotti import DBSession from kotti import metadata from kotti.resources import _adjust_for_engine from kotti.testing import testing_db_url engine = create_engine(testing_db_url()) _adjust_for_engine(engine) connection = engine.connect() DBSession.registry.clear() DBSession.configure(bind=connection) metadata.bind = engine return connection
def required_settings(self): return {'sqlalchemy.url': testing_db_url(), 'kotti.secret': 'dude'}
def setUp(self, **kwargs): self.settings = {'kotti.configurators': 'kotti_software.kotti_configure', 'sqlalchemy.url': testing_db_url(), 'kotti.secret': 'dude', 'kotti_software.collection_settings.pagesize': '5'} super(FunctionalTests, self).setUp(**self.settings)
def required_settings(self): return {'sqlalchemy.url': testing_db_url(), 'kotti.secret': 'dude'}
def required_settings(self): return {"sqlalchemy.url": testing_db_url(), "kotti.secret": "dude"}
def required_settings(self): return {"sqlalchemy.url": testing_db_url(), "kotti.secret": "dude"}