test_script_password.py
1 from .common import check_assert, check_command, check_returncode 2 3 # FIXME: Use something like this here: https://stackoverflow.com/questions/41542960/run-interactive-bash-with-popen-and-a-dedicated-tty-python 4 # def test_password_complexity(): 5 # result = check_command('./passwd_complexity', '--interactive', input='aA1! \n') 6 # check_returncode(result) 7 # check_assert(result, 'Found 5 characters in the password!' in result.stdout) 8 # check_assert(result, 'Found characters in 5 different character classes!' in result.stdout) 9 10 11 def test_password_complexity_no_input(): 12 result = check_command('./passwd_complexity') 13 check_returncode(result, 1) 14 check_assert(result, 'No password provided!' in result.stdout) 15 16 17 # def test_password_confirm(): 18 # result = check_command('./passwd_confirm', '--interactive', input='a\na') 19 # check_returncode(result) 20 # check_assert(result, 'Enter password:' in result.stdout) 21 # check_assert(result, 'Confirm password:' in result.stdout) 22 23 24 def test_password_confirm_no_input(): 25 result = check_command('./passwd_confirm') 26 check_returncode(result, 1)