示例#1
0
def test_blueprint_factory_default():
    salesforce_bp = make_salesforce_blueprint(
        client_id="foo",
        client_secret="bar",
        scope="api",
        redirect_to="index",
    )
    assert isinstance(salesforce_bp, OAuth2ConsumerBlueprint)
    assert salesforce_bp.session.scope == "api"
    assert salesforce_bp.session.base_url == "https://login.salesforce.com/"
    assert salesforce_bp.session.client_id == "foo"
    assert salesforce_bp.client_secret == "bar"
    assert (salesforce_bp.authorization_url ==
            "https://login.salesforce.com/services/oauth2/authorize")
    assert (salesforce_bp.token_url ==
            "https://login.salesforce.com/services/oauth2/token")
示例#2
0
def test_blueprint_factory_scope():
    salesforce_bp = make_salesforce_blueprint(client_id="foo",
                                              client_secret="bar",
                                              scope="customscope")
    assert salesforce_bp.session.scope == "customscope"
示例#3
0
 def _make_app(*args, **kwargs):
     app = Flask(__name__)
     app.secret_key = "whatever"
     blueprint = make_salesforce_blueprint(*args, **kwargs)
     app.register_blueprint(blueprint)
     return app