Mercurial > p > roundup > code
comparison test/test_admin.py @ 8244:b4ad03927711
test: fix failing test setup for change in PBKDF2 rounds.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 30 Dec 2024 21:03:01 -0500 |
| parents | c12377fb4144 |
| children | 1a93dc58f975 |
comparison
equal
deleted
inserted
replaced
| 8243:8c1e0459b73d | 8244:b4ad03927711 |
|---|---|
| 690 # Reopen the db closed by previous call | 690 # Reopen the db closed by previous call |
| 691 self.admin=AdminTool() | 691 self.admin=AdminTool() |
| 692 | 692 |
| 693 ### test replacement of old default value | 693 ### test replacement of old default value |
| 694 replace_in_file(self.dirname + "/config.ini", | 694 replace_in_file(self.dirname + "/config.ini", |
| 695 "= 2000000", "= 10000") | 695 "= 250000", "= 10000") |
| 696 | |
| 696 with captured_output() as (out, err): | 697 with captured_output() as (out, err): |
| 697 sys.argv=['main', '-i', self.dirname, 'update', | 698 sys.argv=['main', '-i', self.dirname, 'update', |
| 698 self.dirname + "/config2.ini"] | 699 self.dirname + "/config2.ini"] |
| 699 ret = self.admin.main() | 700 ret = self.admin.main() |
| 700 | 701 |
| 701 out = out.getvalue().strip() | 702 out = out.getvalue().strip() |
| 702 print(out) | 703 print(out) |
| 703 expected = "from old default of 10000 to new default of 2000000." | 704 expected = "from old default of 10000 to new default of 250000." |
| 704 | 705 |
| 705 self.assertIn(expected, out) | 706 self.assertIn(expected, out) |
| 706 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) | 707 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
| 707 self.assertEqual(find_in_file(self.dirname + "/config2.ini", | 708 self.assertEqual(find_in_file(self.dirname + "/config2.ini", |
| 708 "^password_.*= 2000000$"), | 709 "^password_.*= 250000$"), |
| 709 "password_pbkdf2_default_rounds = 2000000") | 710 "password_pbkdf2_default_rounds = 250000") |
| 710 | 711 |
| 711 # Reopen the db closed by previous call | 712 # Reopen the db closed by previous call |
| 712 self.admin=AdminTool() | 713 self.admin=AdminTool() |
| 713 | 714 |
| 714 ### test replacement of too small value | 715 ### test replacement of too small value |
| 720 ret = self.admin.main() | 721 ret = self.admin.main() |
| 721 | 722 |
| 722 out = out.getvalue().strip() | 723 out = out.getvalue().strip() |
| 723 print(out) | 724 print(out) |
| 724 expected = ("Update 'password_pbkdf2_default_rounds' to a number " | 725 expected = ("Update 'password_pbkdf2_default_rounds' to a number " |
| 725 "equal to or larger\n than 2000000.") | 726 "equal to or larger\n than 250000.") |
| 726 | 727 |
| 727 self.assertIn(expected, out) | 728 self.assertIn(expected, out) |
| 728 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) | 729 self.assertTrue(os.path.isfile(self.dirname + "/config2.ini")) |
| 729 self.assertEqual(find_in_file(self.dirname + "/config2.ini", | 730 self.assertEqual(find_in_file(self.dirname + "/config2.ini", |
| 730 "^password_.*= 10001$"), | 731 "^password_.*= 10001$"), |
