How to use the emmett.App function in emmett

To help you get started, we’ve selected a few emmett examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emmett-framework / emmett / tests / test_logger.py View on Github external
def test_user_assign_valid_level():
    app = App(__name__)
    app.config.logging.pytest = sdict(
        level='info'
    )
    result = _call_create_logger(app)
    assert result.handlers[-1].level == logging.INFO
github emmett-framework / emmett / tests / test_mailer.py View on Github external
def app():
    rv = App(__name__)
    rv.config.mailer.sender = 'support@example.com'
    return rv
github emmett-framework / emmett / tests / test_auth.py View on Github external
def app():
    rv = App(__name__)
    rv.config.mailer.sender = 'nina@massivedynamics.com'
    rv.config.auth.single_template = True
    rv.config.auth.hmac_key = "foobar"
    rv.pipeline = [SessionManager.cookies('foobar')]
    return rv
github emmett-framework / emmett / tests / test_logger.py View on Github external
def test_user_assign_invaild_level():
    app = App(__name__)
    app.config.logging.pytest = sdict(
        level='invalid'
    )
    result = _call_create_logger(app)
    assert result.handlers[-1].level == logging.WARNING
github emmett-framework / emmett / tests / test_logger.py View on Github external
def test_user_no_assign_level():
    app = App(__name__)
    app.config.logging.pytest = sdict()
    result = _call_create_logger(app)
    assert result.handlers[-1].level == logging.WARNING
github emmett-framework / emmett / tests / test_orm_transactions.py View on Github external
def db():
    app = App(__name__)
    db = Database(
        app, config=sdict(
            uri='sqlite:memory', auto_migrate=True, auto_connect=True))
    db.define_models(Register)
    return db
github emmett-framework / emmett / tests / test_routing.py View on Github external
def app():
    app = App(__name__)
    app.languages = ['en', 'it']
    app.language_default = 'en'
    app.language_force_on_url = True

    @app.route()
    def test_route():
        return 'Test Router'

    @app.route()
    def test_404():
        abort(404, 'Not found, dude')

    @app.route('/test2//')
    def test_route2(a, b):
        return 'Test Router'
github emmett-framework / emmett / tests / test_migrations.py View on Github external
def app():
    rv = App(__name__)
    rv.config.db.uri = 'sqlite:memory'
    return rv