def setup_environment_and_database(env_dir=None, enabled_plugins=''): global_config = {} env_dir = env_dir or '/invalid' app_config = { 'plugins': enabled_plugins, 'sqlalchemy.url': 'sqlite://', 'layout_template': 'layout', 'external_template': 'false', 'image_dir': os.path.join(env_dir, 'images'), 'media_dir': os.path.join(env_dir, 'media'), } pylons_config = load_environment(global_config, app_config) metadata.create_all(bind=DBSession.bind, checkfirst=True) return pylons_config
def setUp(self): super(DBTestCase, self).setUp() global_config = { 'plugins': '', # 'debug': 'true', # 'error_email_from': 'paste@localhost', # '__file__': '.../standalone.ini', # 'here': '...', # 'smtp_server': 'localhost' } local_config = { 'sqlalchemy.url': 'sqlite://', # 'full_stack': 'true', # 'image_dir': '.../data/images', # 'enable_gzip': 'true', # 'static_files': 'true', # 'external_template': 'false', # 'sqlalchemy.echo': 'False', # 'file_serve_method': 'default', # 'app_instance_uuid': '', str(uuid.uuid4()) # 'media_dir': '.../data/media', # 'sqlalchemy.pool_recycle': '3600', # 'layout_template': 'layout', # 'sa_auth.cookie_secret': 'superdupersecret', # 'cache_dir': '.../data', # 'external_template_url': 'http://some/valid_genshi_template.html', # 'external_template_timeout': '600', # 'beaker.session.key': 'mediacore', # 'external_template_name': 'external', # 'beaker.session.secret': 'superdupersecret' } self.pylons_config = load_environment(global_config, local_config) metadata.create_all(bind=DBSession.bind, checkfirst=True) add_default_data() DBSession.commit() config.push_process_config(self.pylons_config)