island: Add tests for UserCreds.__bool__()

This commit is contained in:
Mike Salvatore 2021-05-04 17:14:54 -04:00
parent d56cb5cd75
commit e223126c16
1 changed files with 16 additions and 0 deletions

View File

@ -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() == {}