Question: Create a Pytest script for the following functions: def login(): global users count = 0 while True: userName = input('Login: ') password = input('Password: ')
Create a Pytest script for the following functions:
def login():
global users count = 0 while True: userName = input('Login: ') password = input('Password: ') currentUser = validateUser(userName, password) if currentUser is not None: break print('Incorrect login. Try Again.') failedLogin(userName) count = count + 1 if (count > 4): count = 0 print('Too many failed attempts, System locking down') lockedSystemReport(userName) timex.sleep(3600) if not validateAccessTime(currentUser): print('You are not within range of your access time. Try again later.') exit() print('Logged in successfully. ') loginReport(userName) checkPasswordExpiration(currentUser) return currentUser
def changePassword(user):
currPass = input('Enter your current password: ') if not decrypt(user) == currPass: print('Incorrect password. ') return newPass = input('Enter your new password: ') if user.searchOldPasswords(newPass): print('Cannot reuse old password. ') return while not validatePassword(newPass): newPass = input(' Enter your new password: ') if user.searchOldPasswords(newPass): print('Cannot reuse old password. ') return confirmPass = input('Re-enter your new password: ') if not newPass == confirmPass: print("Passwords do not match. ") return Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
