def test_current_auth(self): env = "testing" init_app(self.app, env) with self.app.test_request_context(): self.assertEqual( render_template_string('{% if current_auth.is_authenticated %}Yes{% else %}No{% endif %}'), 'No')
def test_current_auth(self): environ['FLASK_ENV'] = "testing" init_app(self.app) with self.app.test_request_context(): assert (render_template_string( '{% if current_auth.is_authenticated %}Yes{% else %}No{% endif %}' ) == 'No')
def init_for(env): init_app(app, env) init_app(eventapp, env) app.config['tz'] = timezone(eventapp.config['TIMEZONE']) eventframe.models.db.init_app(app) eventframe.models.db.init_app(eventapp) lastuser.init_app(app) lastuser.init_usermanager(UserManager(eventframe.models.db, eventframe.models.User)) assets.register('js_all', js) assets.register('css_all', css) eventassets.register('js_baseframe', baseframe_js) eventassets.register('css_baseframe', baseframe_css) setup_themes(eventapp, app_identifier='eventframe') setup_themes(app, app_identifier='eventframe') # To list themes in the admin views for theme in eventapp.theme_manager.list_themes(): load_theme_assets(eventassets, theme) return DomainDispatcher(app.config['ADMIN_HOSTS'], app, eventapp)
def init_for(env): init_app(app, env) init_app(eventapp, env) app.config['tz'] = timezone(eventapp.config['TIMEZONE']) eventframe.models.db.init_app(app) eventframe.models.db.init_app(eventapp) lastuser.init_app(app) lastuser.init_usermanager( UserManager(eventframe.models.db, eventframe.models.User)) assets.register('js_all', js) assets.register('css_all', css) eventassets.register('js_baseframe', baseframe_js) eventassets.register('css_baseframe', baseframe_css) setup_themes(eventapp, app_identifier='eventframe') setup_themes( app, app_identifier='eventframe') # To list themes in the admin views for theme in eventapp.theme_manager.list_themes(): load_theme_assets(eventassets, theme) return DomainDispatcher(app.config['ADMIN_HOSTS'], app, eventapp)
def init_for(env): init_app(app, env) init_app(eventapp, env) app.config['tz'] = timezone(eventapp.config['TIMEZONE']) eventframe.models.db.init_app(app) eventframe.models.db.init_app(eventapp) baseframe.baseframe.init_app(app, requires=['baseframe', 'toastr', 'eventframe']) baseframe.baseframe.init_app(eventapp, requires=[], assetenv=eventassets) eventapp.assets = eventassets # Replace baseframe-provided Environment with ThemeAwareEnvironment lastuser.init_app(app) lastuser.init_usermanager(UserManager(eventframe.models.db, eventframe.models.User)) eventassets.register('js_baseframe', Bundle(baseframe.assets.require('baseframe.js'), filters='uglipyjs', output='js/packed.js')) eventassets.register('css_baseframe', Bundle(baseframe.assets.require('baseframe.css'), filters='cssmin', output='css/packed.css')) setup_themes(eventapp, app_identifier='eventframe') setup_themes(app, app_identifier='eventframe') # To list themes in the admin views for theme in eventapp.theme_manager.list_themes(): load_theme_assets(eventassets, theme) return DomainDispatcher(app.config['ADMIN_HOSTS'], app, eventapp)
def test_init_app(self): env = "testing" init_app(self.app, env) self.assertEqual(self.app.config['SETTINGS_KEY'], "settings") self.assertEqual(self.app.config['TEST_KEY'], "test")
# Third, import models, nodes and views import eventframe.models import eventframe.nodes eventframe.nodes.init() import eventframe.views from eventframe.models import db # NOQA # Fourth, setup baseframe, assets and theme assets on both apps baseframe.assets['eventframe.css'][version] = 'css/app.css' eventassets = ThemeAwareEnvironment(eventapp) init_app(app) init_app(eventapp) app.config['tz'] = timezone(eventapp.config['TIMEZONE']) eventframe.models.db.init_app(app) eventframe.models.db.init_app(eventapp) migrate = Migrate(app, eventframe.models.db) baseframe.baseframe.init_app(app, requires=['baseframe', 'toastr', 'eventframe']) baseframe.baseframe.init_app(eventapp, requires=['baseframe'], assetenv=eventassets) eventapp.assets = eventassets # Replace baseframe-provided Environment with ThemeAwareEnvironment lastuser.init_app(app) lastuser.init_usermanager(UserManager(eventframe.models.db, eventframe.models.User)) eventassets.register('js_baseframe', Bundle(baseframe.assets.require('baseframe.js'), filters='uglipyjs', output='js/packed.js')) eventassets.register('css_baseframe', Bundle(baseframe.assets.require('baseframe.css'), filters='cssmin', output='css/packed.css'))
def test_init_app(self): environ['FLASK_ENV'] = "testing" init_app(self.app) assert self.app.config['SETTINGS_KEY'] == "settings" assert self.app.config['TEST_KEY'] == "test"
def test_init_app(self): env = "testing" init_app(self.app, env) self.assertEqual(self.app.config['SETTINGS_KEY'], "settings") self.assertEqual(self.app.config['TEST_KEY'], "test")