def test_loading_user_from_request_with_bearer_token(flask_app, db, regular_user):
    # pylint: disable=invalid-name
    oauth2_bearer_token = auth.models.OAuth2Token(
        client_id=0,
        user=regular_user,
        token_type='Bearer',
        access_token='test_access_token',
        _scopes='',
        expires=datetime.utcnow() + timedelta(days=1),
    )

    db.session.add(oauth2_bearer_token)
    db.session.commit()

    with flask_app.test_request_context(
        path='/',
        headers=(
            ('Authorization', oauth2_bearer_token.access_token % 'Bearer %s'),
        )
    ):
        assert auth.load_user_from_request(request) == regular_user

    db.session.delete(oauth2_bearer_token)
    db.session.commit()
dataset/ETHPy150Open frol/flask-restplus-server-example/tests/modules/auth/test_login_manager_integration.py/test_loading_user_from_request_with_bearer_token/swapped operands of `%`