Beispiel #1
0
def test_handle_auth_error(mocker):
    flash = mocker.patch("flask_multipass.core.flash")
    app = Flask("test")
    app.config["SECRET_KEY"] = "testing"
    multipass = Multipass(app)
    with app.test_request_context():
        multipass.handle_auth_error(AuthenticationFailed())
        assert flash.called
        assert session["_multipass_auth_failed"]
Beispiel #2
0
def test_handle_auth_error(mocker):
    flash = mocker.patch('flask_multipass.core.flash')
    app = Flask('test')
    app.config['SECRET_KEY'] = 'testing'
    multipass = Multipass(app)
    with app.test_request_context():
        multipass.handle_auth_error(AuthenticationFailed())
        assert flash.called
        assert session['_multipass_auth_failed']
Beispiel #3
0
def test_handle_auth_error(mocker):
    flash = mocker.patch('flask_multipass.core.flash')
    app = Flask('test')
    app.config['SECRET_KEY'] = 'testing'
    multipass = Multipass(app)
    with app.test_request_context():
        multipass.handle_auth_error(AuthenticationFailed())
        assert flash.called
        assert session['_multipass_auth_failed']
Beispiel #4
0
def test_handle_auth_error_with_redirect(mocker):
    flash = mocker.patch("flask_multipass.core.flash")
    redirect = mocker.patch("flask_multipass.core.redirect")
    app = Flask("test")
    app.config["SECRET_KEY"] = "testing"
    multipass = Multipass(app)
    with app.test_request_context():
        multipass.handle_auth_error(AuthenticationFailed(), redirect_to_login=True)
        assert flash.called
        redirect.assert_called_with(app.config["MULTIPASS_LOGIN_URLS"][0])
Beispiel #5
0
def test_handle_auth_error_with_redirect(mocker):
    flash = mocker.patch('flask_multipass.core.flash')
    redirect = mocker.patch('flask_multipass.core.redirect')
    app = Flask('test')
    app.config['SECRET_KEY'] = 'testing'
    multipass = Multipass(app)
    with app.test_request_context():
        multipass.handle_auth_error(AuthenticationFailed(), redirect_to_login=True)
        assert flash.called
        redirect.assert_called_with(app.config['MULTIPASS_LOGIN_URLS'][0])
Beispiel #6
0
def test_handle_auth_error_with_redirect(mocker):
    flash = mocker.patch('flask_multipass.core.flash')
    redirect = mocker.patch('flask_multipass.core.redirect')
    app = Flask('test')
    app.config['SECRET_KEY'] = 'testing'
    multipass = Multipass(app)
    with app.test_request_context():
        multipass.handle_auth_error(AuthenticationFailed(), redirect_to_login=True)
        assert flash.called
        redirect.assert_called_with(app.config['MULTIPASS_LOGIN_URLS'][0])