aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlandos <bugs-github@antipoul.fr>2021-06-07 23:11:38 +0200
committerGitHub <noreply@github.com>2021-06-07 23:11:38 +0200
commit859aa8fb1e2f0ddd575159187440a51fdd08b3f0 (patch)
tree5bb724ce108959b36d6e71e53a1600fe68d1368c
parent3894f1568ad25488d3ebed83b26daa9da027eed1 (diff)
downloadihatemoney-mirror-859aa8fb1e2f0ddd575159187440a51fdd08b3f0.zip
ihatemoney-mirror-859aa8fb1e2f0ddd575159187440a51fdd08b3f0.tar.gz
ihatemoney-mirror-859aa8fb1e2f0ddd575159187440a51fdd08b3f0.tar.bz2
Fix test for generate_hash_password (#766)
Use the function that check password instead of just checking the output length. This length can be variable and will change with Werkzeug 2
-rw-r--r--ihatemoney/tests/main_test.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ihatemoney/tests/main_test.py b/ihatemoney/tests/main_test.py
index f052ee0..d495f3a 100644
--- a/ihatemoney/tests/main_test.py
+++ b/ihatemoney/tests/main_test.py
@@ -5,6 +5,7 @@ import unittest
from unittest.mock import MagicMock, patch
from sqlalchemy import orm
+from werkzeug.security import check_password_hash
from ihatemoney import models
from ihatemoney.currency_convertor import CurrencyConverter
@@ -90,7 +91,7 @@ class CommandTestCase(BaseTestCase):
runner = self.app.test_cli_runner()
with patch("getpass.getpass", new=lambda prompt: "secret"):
result = runner.invoke(password_hash)
- self.assertEqual(len(result.output.strip()), 94)
+ self.assertTrue(check_password_hash(result.output.strip(), "secret"))
def test_demo_project_deletion(self):
self.create_project("demo")