From 58b04ecb918562f1a06330aa58ae93d28db8fa75 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 18 May 2021 10:03:59 +0300 Subject: [PATCH] Added unit test of random password generator --- .../utils/test_random_password_generator.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 monkey/tests/infection_monkey/utils/test_random_password_generator.py diff --git a/monkey/tests/infection_monkey/utils/test_random_password_generator.py b/monkey/tests/infection_monkey/utils/test_random_password_generator.py new file mode 100644 index 000000000..bdd97cdfd --- /dev/null +++ b/monkey/tests/infection_monkey/utils/test_random_password_generator.py @@ -0,0 +1,13 @@ +from infection_monkey.utils.random_password_generator import get_random_password + + +def test_get_random_password__length(): + password_byte_length = len(get_random_password().encode()) + # 32 is the recommended secure byte length for secrets + assert password_byte_length >= 32 + + +def test_get_random_password__randomness(): + random_password1 = get_random_password() + random_password2 = get_random_password() + assert not random_password1 == random_password2