From 859aa8fb1e2f0ddd575159187440a51fdd08b3f0 Mon Sep 17 00:00:00 2001 From: Glandos Date: Mon, 7 Jun 2021 23:11:38 +0200 Subject: 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 --- ihatemoney/tests/main_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ihatemoney') 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") -- cgit v1.1