Skip to content

Commit 1aa4d69

Browse files
Only hash a global password for all test users (#776)
as hashing password is a time consuming operation. We expect a 2 min gain over our test suite.
1 parent ae7c275 commit 1aa4d69

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/commons.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ def init_test_payment_tools() -> dict[HelloAssoConfigName, PaymentTool]:
155155

156156
hyperion_error_logger = logging.getLogger("hyperion.error")
157157

158+
TEST_PASSWORD_HASH = security.get_password_hash(get_random_string())
159+
158160

159161
async def create_user_with_groups(
160162
groups: list[GroupType],
@@ -176,7 +178,9 @@ async def create_user_with_groups(
176178
"""
177179

178180
user_id = user_id or str(uuid.uuid4())
179-
password_hash = security.get_password_hash(password or get_random_string())
181+
password_hash = (
182+
security.get_password_hash(password) if password else TEST_PASSWORD_HASH
183+
)
180184
school_id = school_id.value if isinstance(school_id, SchoolType) else school_id
181185

182186
user = models_users.CoreUser(

0 commit comments

Comments
 (0)