Skip to content

Commit

Permalink
test: fix failing test setup for change in PBKDF2 rounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
rouilj committed Dec 31, 2024
1 parent 5501821 commit c92aad5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,21 +692,22 @@ def testUpdateconfigPbkdf2(self):

### test replacement of old default value
replace_in_file(self.dirname + "/config.ini",
"= 2000000", "= 10000")
"= 250000", "= 10000")

with captured_output() as (out, err):
sys.argv=['main', '-i', self.dirname, 'update',
self.dirname + "/config2.ini"]
ret = self.admin.main()

out = out.getvalue().strip()
print(out)
expected = "from old default of 10000 to new default of 2000000."
expected = "from old default of 10000 to new default of 250000."

self.assertIn(expected, out)
self.assertTrue(os.path.isfile(self.dirname + "/config2.ini"))
self.assertEqual(find_in_file(self.dirname + "/config2.ini",
"^password_.*= 2000000$"),
"password_pbkdf2_default_rounds = 2000000")
"^password_.*= 250000$"),
"password_pbkdf2_default_rounds = 250000")

# Reopen the db closed by previous call
self.admin=AdminTool()
Expand All @@ -722,7 +723,7 @@ def testUpdateconfigPbkdf2(self):
out = out.getvalue().strip()
print(out)
expected = ("Update 'password_pbkdf2_default_rounds' to a number "
"equal to or larger\n than 2000000.")
"equal to or larger\n than 250000.")

self.assertIn(expected, out)
self.assertTrue(os.path.isfile(self.dirname + "/config2.ini"))
Expand Down

0 comments on commit c92aad5

Please sign in to comment.