# Path: tests/utils.py
# class AutoAuthFlaskClient(FlaskClient):
# class JSONResponse(Response):
#     def __init__(self, *args, **kwargs):
#     def login(self, user, auth_scopes=None):
#     def open(self, *args, **kwargs):
#     def json(self):
# def generate_user_instance(
#         user_id=None,
#         username="username",
#         password=None,
#         email=None,
#         first_name="First Name",
#         middle_name="Middle Name",
#         last_name="Last Name",
#         created=None,
#         updated=None,
#         is_active=True,
#         is_regular_user=True,
#         is_admin=False,
#         is_internal=False
# ):
# 
# Path: app/modules/users/models.py
# def _get_is_static_role_property(role_name, static_role):
#     def _is_static_role_property(self):
#     def _is_static_role_property(self, value):
#         def mask(self):
#         def title(self):
#     def __repr__(self):
#     def has_static_role(self, role):
#     def set_static_role(self, role):
#     def unset_static_role(self, role):
#     def check_owner(self, user):
#     def is_authenticated(self):
#     def is_anonymous(self):
#     def find_with_password(cls, username, password):
# class User(db.Model, Timestamp):
#     class StaticRoles(enum.Enum):
#         INTERNAL = (0x8000, "Internal")
#         ADMIN = (0x4000, "Admin")
#         REGULAR_USER = (0x2000, "Regular User")
#         ACTIVE = (0x1000, "Active Account")


import pytest
from flask_login import current_user, login_user, logout_user
from tests import utils
from app.modules.users import models
# encoding: utf-8
# pylint: disable=missing-docstring,redefined-outer-name





@pytest.yield_fixture()
def patch_User_password_scheme():
    # pylint: disable=invalid-name,protected-access
    """
    By default, the application uses ``bcrypt`` to store passwords securely.
    However, ``bcrypt`` is a slow hashing algorithm (by design), so it is
    better to downgrade it to ``plaintext`` while testing, since it will save
    us quite some time.
    """
    # NOTE: It seems a hacky way, but monkeypatching is a hack anyway.

# Path: tests/utils.py
# class AutoAuthFlaskClient(FlaskClient):
# class JSONResponse(Response):
#     def __init__(self, *args, **kwargs):
#     def login(self, user, auth_scopes=None):
#     def open(self, *args, **kwargs):
#     def json(self):
# def generate_user_instance(
#         user_id=None,
#         username="username",
#         password=None,
#         email=None,
#         first_name="First Name",
#         middle_name="Middle Name",
#         last_name="Last Name",
#         created=None,
#         updated=None,
#         is_active=True,
#         is_regular_user=True,
#         is_admin=False,
#         is_internal=False
# ):
# 
# Path: app/modules/users/models.py
# def _get_is_static_role_property(role_name, static_role):
#     def _is_static_role_property(self):
#     def _is_static_role_property(self, value):
#         def mask(self):
#         def title(self):
#     def __repr__(self):
#     def has_static_role(self, role):
#     def set_static_role(self, role):
#     def unset_static_role(self, role):
#     def check_owner(self, user):
#     def is_authenticated(self):
#     def is_anonymous(self):
#     def find_with_password(cls, username, password):
# class User(db.Model, Timestamp):
#     class StaticRoles(enum.Enum):
#         INTERNAL = (0x8000, "Internal")
#         ADMIN = (0x4000, "Admin")
#         REGULAR_USER = (0x2000, "Regular User")
#         ACTIVE = (0x1000, "Active Account")


# Path: tests/modules/users/conftest.py
import pytest
from flask_login import current_user, login_user, logout_user
from tests import utils
from app.modules.users import models

# encoding: utf-8
# pylint: disable=missing-docstring,redefined-outer-name





@pytest.yield_fixture()
def patch_User_password_scheme():
    # pylint: disable=invalid-name,protected-access
    """
    By default, the application uses ``bcrypt`` to store passwords securely.
    However, ``bcrypt`` is a slow hashing algorithm (by design), so it is
    better to downgrade it to ``plaintext`` while testing, since it will save
    us quite some time.
    """
    # NOTE: It seems a hacky way, but monkeypatching is a hack anyway.

    password_field_context = models.User.password.property.columns[0].type.context