from flask.testing import FlaskClient


class FlaskLoginClient(FlaskClient):
    """
    A Flask test client that knows how to log in users
    using the Flask-Login extension.
    """

    def __init__(self, *args, **kwargs):
        user = kwargs.pop("user", None)
        fresh = kwargs.pop("fresh_login", True)

        super(FlaskLoginClient, self).__init__(*args, **kwargs)

        if user:
            with self.session_transaction() as sess:
                sess["user_id"] = user.id
                sess["_fresh"] = fresh

from flask.testing import FlaskClient


class FlaskLoginClient(FlaskClient):
    """
    A Flask test client that knows how to log in users
    using the Flask-Login extension.
    """

    def __init__(self, *args, **kwargs):
        user = kwargs.pop("user", None)
        fresh = kwargs.pop("fresh_login", True)

        super(FlaskLoginClient, self).__init__(*args, **kwargs)

        if user:
            with self.session_transaction() as sess:
                sess["user_id"] = user.get_id()
                sess["_fresh"] = fresh

test client: refer to get_id()