Esempio n. 1
0
    def init_app(self, app):

        if app.config.get("MODULE_USER_ACCOUNT_ENABLE_OAUTH_LOGIN"):
            secret = app.config.get("SECRET_KEY")
            providers = app.config.get("MODULE_USER_ACCOUNT_OAUTH_PROVIDERS")
            config = {}
            auth_providers = []

            for provider, conf in providers.items():
                if hasattr(oauth2, provider):
                    cls = getattr(oauth2, provider)
                    conf["class_"] = conf["class_"] if "class_" in conf else cls
                elif hasattr(oauth1, provider):
                    cls = getattr(oauth1, provider)
                    conf["class_"] = conf["class_"] if "class_" in conf else cls
                else:
                    continue

                conf["id"] = provider_id()
                _provider = provider.lower()
                auth_providers.append(_provider)
                config[_provider] = conf

            self.oauth = Authomatic(
                config=config,
                secret=secret,
                session=session,
                report_errors=True
            )

            Webmaster.g(OAUTH_PROVIDERS=auth_providers)
Esempio n. 2
0
def test_contact_page():

    @extends(contact_page.contact_page)
    class Index(Webmaster):
        pass

    app = Webmaster.init(__name__, config=config)
    app.testing = True

    with app.test_client() as c:
        data = c.get("/contact").data
Esempio n. 3
0
This is the entry point of the application.

--------------------------------------------------------------------------------

** To serve the local development app

> webcli local -a {project_name}

#---------

** To deploy with Propel ( https://github.com/mardix/propel )

> propel -w

#---------

** To deploy with Gunicorn

> gunicorn app_{project_name}:app

"""

from webmaster import Webmaster

# Import the application's views
import application.{project_name}.views

# 'app' variable name is required if you intend to use it with 'webcli'
app = Webmaster.init(__name__, project="{project_name}")

Esempio n. 4
0

from flask import Flask
import flask_cache
import ses_mailer
import flask_mail
import flask_cloudy
import flask_recaptcha

from webmaster import Webmaster, mailer, cache, storage, recaptcha

conffile = "config.Test"

app = Webmaster.init(__name__, config=conffile)


# Recaptcha
def test_recaptcha():
    assert isinstance(recaptcha, flask_recaptcha.ReCaptcha)

# Storage
def test_storage():
    assert isinstance(storage, flask_cloudy.Storage)

# Cache
def test_cache():
    assert isinstance(cache, flask_cache.Cache)

# Mailer
def test_mailer_none():
    assert mailer.mail is None