test: merge password validation test cases

This commit is contained in:
barredterra 2022-08-15 13:52:32 +02:00
parent c8eab1ef75
commit 2cf45366ec

View file

@ -192,6 +192,12 @@ class TestUser(unittest.TestCase):
# Score 1; should now fail
result = test_password_strength("bee2ve")
self.assertEqual(result["feedback"]["password_policy_validation_passed"], False)
self.assertRaises(
frappe.exceptions.ValidationError, handle_password_test_fail, result["feedback"]
)
self.assertRaises(
frappe.exceptions.ValidationError, handle_password_test_fail, result
) # test backwards compatibility
# Score 4; should pass
result = test_password_strength("Eastern_43A1W")
@ -207,15 +213,6 @@ class TestUser(unittest.TestCase):
user.save()
frappe.flags.in_test = True
def test_password_validation(self):
result = test_password_strength("P@ssw0rd")
feedback = result["feedback"]
self.assertEqual(feedback["password_policy_validation_passed"], False)
self.assertRaises(frappe.exceptions.ValidationError, handle_password_test_fail, feedback)
# test backwards compatibility
self.assertRaises(frappe.exceptions.ValidationError, handle_password_test_fail, result)
def test_comment_mentions(self):
comment = """
<span class="mention" data-id="test.comment@example.com" data-value="Test" data-denotation-char="@">