def configure_app(using): # Simulate starting configuration process from scratch milestones._reset_all() app_cfg = AppConfig(minimal=True) app_cfg.renderers = ['kajiki'] app_cfg.default_renderer = 'kajiki' app_cfg.use_dotted_templatenames = True app_cfg.package = FakeAppPackage() app_cfg.use_toscawidgets2 = True app_cfg['tw2.enabled'] = True app_cfg.sa_auth.authmetadata = TestAuthMetadata() app_cfg['beaker.session.secret'] = app_cfg['session.secret'] = 'SECRET' app_cfg.auth_backend = 'ming' app_cfg['mail.debugmailer'] = "dummy" if using == 'sqlalchemy': app_cfg.package.model = FakeSQLAModel() app_cfg.use_sqlalchemy = True app_cfg['sqlalchemy.url'] = 'sqlite://' app_cfg.use_transaction_manager = True app_cfg['tm.enabled'] = True app_cfg.SQLASession = app_cfg.package.model.DBSession elif using == 'ming': app_cfg.package.model = FakeMingModel() app_cfg.use_ming = True app_cfg['ming.url'] = 'mim:///mailtemapltes' app_cfg.MingSession = app_cfg.package.model.DBSession else: raise ValueError('Unsupported backend') app_cfg.model = app_cfg.package.model app_cfg.DBSession = app_cfg.package.model.DBSession # Guarantee that the same form is used between multiple # configurations of TGApps. Otherwise the validated # form would be different from the displayed one. plug(app_cfg, 'tgext.mailer', plug_bootstrap=True, debugmailer='dummy') plug(app_cfg, 'tgext.asyncjob', plug_bootstrap=True, app_globals=app_cfg['app_globals']) # it is important that tgext.mailer and tgext.asyncjob are plugged # before mailtemplates or not plugged at all as mailtemplates plugs them plug(app_cfg, 'mailtemplates', plug_bootstrap=True, default_language='EN') return app_cfg
def configure_app(using): # Simulate starting configuration process from scratch milestones._reset_all() app_cfg = AppConfig(minimal=True) app_cfg.renderers = ['kajiki'] app_cfg.default_renderer = 'kajiki' app_cfg.use_dotted_templatenames = True app_cfg.package = FakeAppPackage() app_cfg.use_toscawidgets2 = True app_cfg['beaker.session.secret'] = app_cfg['session.secret'] = 'SECRET' app_cfg['mail.debugmailer'] = "dummy" if using == 'sqlalchemy': app_cfg.auth_backend = 'sqlalchemy' app_cfg.package.model = FakeSQLAModel() app_cfg.use_sqlalchemy = True app_cfg['sqlalchemy.url'] = 'sqlite://' app_cfg.use_transaction_manager = True app_cfg.SQLASession = app_cfg.package.model.DBSession elif using == 'ming': app_cfg.auth_backend = 'ming' app_cfg.package.model = FakeMingModel() app_cfg.use_ming = True app_cfg['ming.url'] = 'mim:///userprofile' app_cfg.MingSession = app_cfg.package.model.DBSession else: raise ValueError('Unsupported backend') app_cfg.model = app_cfg.package.model app_cfg.DBSession = app_cfg.package.model.DBSession app_cfg.sa_auth.authmetadata = TestAuthMetadata() # Guarantee that the same form is used between multiple # configurations of TGApps. Otherwise the validated # form would be different from the displayed one. app_cfg['userprofile.email_sender'] = '[email protected]' plug(app_cfg, 'userprofile', plug_bootstrap=True) return app_cfg