Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new test for password reset to user-specified password #14070

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/foreman/destructive/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,30 @@ def test_positive_password_reset(target_sat):
result = target_sat.cli.Auth.with_user().status()
assert LOGEDIN_MSG.format(settings.server.admin_username) in result.split("\n")[1]
assert target_sat.cli.Org.with_user().list()


def test_positive_password_reset_chosen(target_sat):
"""Reset admin password to specified password using foreman rake and update the hammer config. Verify the new password is working.

:id: e8f13a26-2299-4a6b-a2f7-8cb17389d400

:expectedresults: New specified password is set.

:CaseImportance: High
"""
new_password = gen_string('alpha')
result = target_sat.execute(f'foreman-rake permissions:reset password={new_password}')
assert result.status == 0
reset_password = result.stdout.splitlines()[0].split('password: ')[1]
assert reset_password == new_password
result = target_sat.execute(
f'''sed -i -e '/username/d;/password/d;/use_sessions/d' {HAMMER_CONFIG};\
echo ' :use_sessions: true' >> {HAMMER_CONFIG}'''
)
assert result.status == 0
target_sat.cli.AuthLogin.basic(
{'username': settings.server.admin_username, 'password': new_password}
)
result = target_sat.cli.Auth.with_user().status()
assert LOGEDIN_MSG.format(settings.server.admin_username) in result.split("\n")[1]
assert target_sat.cli.Org.with_user().list()
Loading