def test_pwd_update(self): scss.update_pw('test-user', 'test-password-12345') test = scss.check_pw('test-user', 'test-password-12345') assert test is True
def test_auth_failure(self): test = scss.check_pw('test-user', 'bad_password') assert test is False
def test_mfa(self): auth = scss.check_pw('test-user', 'test-password-1234') api_key = scss.get_api_key('test-user', auth) otp = TOTP('2UVQE7LDNU5XZWANIDTJA43W6I').now() test = scss.check_totp(otp, api_key) assert test is True
def test_userid_fail(self): auth = scss.check_pw('test-user', 'test-password-1234') api_key = scss.get_api_key('test-user', auth) api_status = scss.check_api_key(api_key) test = scss.check_userid(api_status, api_key, '*****@*****.**') assert test is False
def test_api_auth(self): auth = scss.check_pw('test-user', 'test-password-1234') api_key = scss.get_api_key('test-user', auth) test = scss.check_api_key(api_key) assert test is True
def test_api_key_format(self): auth = scss.check_pw('test-user', 'test-password-1234') apikey = scss.get_api_key('test-user', auth) test = validate_api_key(apikey) assert test is True
def test_api_retrieval(self): auth = scss.check_pw('test-user', 'test-password-1234') test = scss.get_api_key('test-user', auth) assert test is not False
def test_auth(self): test = scss.check_pw('test-user', 'test-password-1234') assert test is True
if args.action.lower() == 'update-api': username = input('What is the username?> ') api_key = scss.update_api_key(username) print('The new api key for %s is %s' % (username, api_key)) if args.action.lower() == 'update-totp': username = input('What is the username?> ') totp = scss.update_otp_token(username) print('The new TOTP token for %s is %s' % (username, totp)) if args.action.lower() == 'update-pw': username = input('What is the username?> ') password = input('What is the new password?> ') scss.update_pw(username, password) update_check = scss.check_pw(username, password) if update_check: print('Password succesfully changed for %s' % username) else: print('Password not changed for %s' % username) if args.action.lower() == 'unlock': username = input('What is the username?> ') unlock = scss.unlock_user(username) if unlock: print('%s has been succesfully unlocked.' % username) else: print('Failed to unlock account for %s' % username) if args.action.lower() == 'lock': username = input('What is the username?> ')