From e223126c1611887d8fc412730a07ddffbb7496f5 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 4 May 2021 17:14:54 -0400 Subject: [PATCH] island: Add tests for UserCreds.__bool__() --- .../cc/environment/test_user_creds.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/monkey/tests/monkey_island/cc/environment/test_user_creds.py b/monkey/tests/monkey_island/cc/environment/test_user_creds.py index 87286fc60..16fa9ee61 100644 --- a/monkey/tests/monkey_island/cc/environment/test_user_creds.py +++ b/monkey/tests/monkey_island/cc/environment/test_user_creds.py @@ -5,6 +5,22 @@ from monkey_island.cc.environment.user_creds import UserCreds TEST_SALT = b"$2b$12$JA7GdT1iyfIsquF2cTZv2." +def test_bool_true(): + assert UserCreds("Test", "abc1231234") + + +def test_bool_false_empty_password_hash(): + assert not UserCreds("Test", "") + + +def test_bool_false_empty_user(): + assert not UserCreds("", "abc1231234") + + +def test_bool_false_empty_user_and_password_hash(): + assert not UserCreds("", "") + + def test_to_dict_empty_creds(): user_creds = UserCreds("", "") assert user_creds.to_dict() == {}