Skip to content

Commit

Permalink
[6.15.z] Add a new test for password reset to user-specified password (
Browse files Browse the repository at this point in the history
  • Loading branch information
Satellite-QE authored Feb 22, 2024
1 parent b1a0861 commit 0f436d1
Showing 1 changed file with 27 additions and 0 deletions.
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()

0 comments on commit 0f436d1

Please sign in to comment.