1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 15:35:22 +02:00

Centralize all test password references

This commit is contained in:
Zach Gollwitzer 2025-04-10 17:26:29 -04:00
parent 3889134746
commit 37e3f44ad7
4 changed files with 11 additions and 7 deletions

View file

@ -13,7 +13,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
visit new_session_path
within "form" do
fill_in "Email", with: user.email
fill_in "Password", with: "maybetestpassword817983172"
fill_in "Password", with: user_password_test
click_on "Log in"
end

View file

@ -54,7 +54,7 @@ class MfaControllerTest < ActionDispatch::IntegrationTest
@user.enable_mfa!
sign_out
post sessions_path, params: { email: @user.email, password: "password" }
post sessions_path, params: { email: @user.email, password: user_password_test }
assert_redirected_to verify_mfa_path
get verify_mfa_path
@ -67,7 +67,7 @@ class MfaControllerTest < ActionDispatch::IntegrationTest
@user.enable_mfa!
sign_out
post sessions_path, params: { email: @user.email, password: "password" }
post sessions_path, params: { email: @user.email, password: user_password_test }
totp = ROTP::TOTP.new(@user.otp_secret, issuer: "Maybe")
post verify_mfa_path, params: { code: totp.now }
@ -81,7 +81,7 @@ class MfaControllerTest < ActionDispatch::IntegrationTest
@user.enable_mfa!
sign_out
post sessions_path, params: { email: @user.email, password: "password" }
post sessions_path, params: { email: @user.email, password: user_password_test }
backup_code = @user.otp_backup_codes.first
post verify_mfa_path, params: { code: backup_code }
@ -96,7 +96,7 @@ class MfaControllerTest < ActionDispatch::IntegrationTest
@user.enable_mfa!
sign_out
post sessions_path, params: { email: @user.email, password: "password" }
post sessions_path, params: { email: @user.email, password: user_password_test }
post verify_mfa_path, params: { code: "invalid" }
assert_response :unprocessable_entity

View file

@ -42,7 +42,7 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
@user.enable_mfa!
@user.sessions.destroy_all # Clean up any existing sessions
post sessions_path, params: { email: @user.email, password: "password" }
post sessions_path, params: { email: @user.email, password: user_password_test }
assert_redirected_to verify_mfa_path
assert_equal @user.id, session[:mfa_user_id]

View file

@ -49,7 +49,7 @@ module ActiveSupport
# Add more helper methods to be used by all tests here...
def sign_in(user)
post sessions_path, params: { email: user.email, password: "maybetestpassword817983172" }
post sessions_path, params: { email: user.email, password: user_password_test }
end
def with_env_overrides(overrides = {}, &block)
@ -60,6 +60,10 @@ module ActiveSupport
Rails.configuration.stubs(:app_mode).returns("self_hosted".inquiry)
yield
end
def user_password_test
"maybetestpassword817983172"
end
end
end