github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/tests/suites/user/login_password.sh (about)

     1  # run_user_change_password changes the 'admin' user password, logout and tries to login with new password
     2  run_user_change_password() {
     3  	# Echo out to ensure nice output to the test suite.
     4  	echo
     5  
     6  	# The following ensures that a bootstrap juju exists.
     7  	file="${TEST_DIR}/test-user-change-password.log"
     8  	ensure "user-change-password" "${file}"
     9  
    10  	echo "Add test-change-password-user"
    11  	juju add-user test-change-password-user
    12  
    13  	echo "Change test-change-password-user password"
    14  	echo "test-password" | juju change-user-password test-change-password-user --no-prompt
    15  
    16  	echo "Change admin password"
    17  	echo "admin-password" | juju change-user-password admin --no-prompt
    18  
    19  	echo "Logout"
    20  	juju logout
    21  
    22  	echo "Login as test-change-password-user"
    23  	echo "test-password" | juju login --user test-change-password-user --no-prompt
    24  
    25  	echo "Logout"
    26  	juju logout
    27  
    28  	echo "Login as admin"
    29  	echo "admin-password" | juju login --user admin --no-prompt
    30  
    31  	destroy_model "user-change-password"
    32  }
    33  
    34  test_user_login_password() {
    35  	if [ -n "$(skip 'test_user_login_password')" ]; then
    36  		echo "==> SKIP: Asked to skip user login/password tests"
    37  		return
    38  	fi
    39  
    40  	(
    41  		set_verbosity
    42  
    43  		cd .. || exit
    44  
    45  		run "run_user_change_password"
    46  	)
    47  }