Skip to content

Commit

Permalink
Remove passlib assumption from pycrypto tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-czernek committed Jul 17, 2024
1 parent 4054cf4 commit d8359f3
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions tests/pytests/unit/utils/test_pycrypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,20 @@ def test_gen_hash_crypt(algorithm, expected):
"""
Test gen_hash with crypt library
"""
with patch("salt.utils.pycrypto.methods", {}):
ret = salt.utils.pycrypto.gen_hash(
crypt_salt=expected["salt"], password=passwd, algorithm=algorithm
)
assert ret == expected["hashed"]
ret = salt.utils.pycrypto.gen_hash(
crypt_salt=expected["salt"], password=passwd, algorithm=algorithm
)
assert ret == expected["hashed"]

ret = salt.utils.pycrypto.gen_hash(
crypt_salt=expected["badsalt"], password=passwd, algorithm=algorithm
)
assert ret != expected["hashed"]
ret = salt.utils.pycrypto.gen_hash(
crypt_salt=expected["badsalt"], password=passwd, algorithm=algorithm
)
assert ret != expected["hashed"]

ret = salt.utils.pycrypto.gen_hash(
crypt_salt=None, password=passwd, algorithm=algorithm
)
assert ret != expected["hashed"]
ret = salt.utils.pycrypto.gen_hash(
crypt_salt=None, password=passwd, algorithm=algorithm
)
assert ret != expected["hashed"]


@pytest.mark.skipif(not salt.utils.pycrypto.HAS_CRYPT, reason="crypt not available")
Expand Down

0 comments on commit d8359f3

Please sign in to comment.