comparison test/test_cgi.py @ 7184:8b2287d850c8

Fix round check/settings in needs_migration Support test rounds in needs_migration Two test were missing os.environ seting to have them use config setting.
author John Rouillard <rouilj@ieee.org>
date Sun, 26 Feb 2023 16:17:37 -0500
parents 1549c7e74ef8
children 978285986b2c
comparison
equal deleted inserted replaced
7183:2de72f75f2f8 7184:8b2287d850c8
591 591
592 # migrate if rounds has increased above rounds was 10000 592 # migrate if rounds has increased above rounds was 10000
593 # below will be 100000 593 # below will be 100000
594 cl.db.Otk = self.db.Otk 594 cl.db.Otk = self.db.Otk
595 pw1 = pw 595 pw1 = pw
596 # do not use the production number of PBKDF2
597 os.environ["PYTEST_USE_CONFIG"] = "True"
596 cl.db.config.PASSWORD_PBKDF2_DEFAULT_ROUNDS = 100000 598 cl.db.config.PASSWORD_PBKDF2_DEFAULT_ROUNDS = 100000
597 self.assertEqual(pw1.needs_migration(config=cl.db.config), True) 599 self.assertEqual(pw1.needs_migration(config=cl.db.config), True)
598 scheme = password.Password.known_schemes[0] 600 scheme = password.Password.known_schemes[0]
599 self.assertEqual(scheme, pw1.scheme) 601 self.assertEqual(scheme, pw1.scheme)
600 actions.LoginAction(cl).handle() 602 actions.LoginAction(cl).handle()
601 pw = cl.db.user.get(chef, 'password') 603 pw = cl.db.user.get(chef, 'password')
602 self.assertEqual(pw, 'foo') 604 self.assertEqual(pw, 'foo')
605 del(os.environ["PYTEST_USE_CONFIG"])
603 # do not assert self.assertEqual(pw, pw1) as pw is a 100,000 606 # do not assert self.assertEqual(pw, pw1) as pw is a 100,000
604 # cycle while pw1 is only 10,000. They won't compare equally. 607 # cycle while pw1 is only 10,000. They won't compare equally.
605 608
606 cl.db.close() 609 cl.db.close()
607 610

Roundup Issue Tracker: http://roundup-tracker.org/