Skip to content

Commit b3c5a62

Browse files
author
¨eadwinCode¨
committed
fixed test coverage
1 parent b1032ef commit b3c5a62

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ellar/core/security/hashers/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ def verify(self, secret: EncodingType, hash_secret: str) -> bool:
8989
secret, hash_secret
9090
)
9191

92+
@abstractmethod
9293
def must_update(self, encoded: str) -> bool:
93-
return self.hasher.needs_update(encoded) # type: ignore[no-any-return]
94+
"""Checks if a hash needs to be updated
95+
96+
if you using passlib hash, simple call hasher.need_update(encoded)
97+
"""
98+
pass
9499

95100
@classmethod
96101
def identity(cls, encoded: str) -> bool:

tests/test_hashers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ def test_invalid_password(self):
6767
with pytest.raises(TypeError, match=msg):
6868
make_password(1)
6969

70+
def test_check_password_invalid_hasher(self):
71+
encoded = make_password(
72+
"lètmein",
73+
"pbkdf2_sha256",
74+
"seasalt",
75+
)
76+
assert check_password("lètmein", f"asas+{encoded}") is False
77+
7078
def test_pbkdf2(self):
7179
encoded = make_password(
7280
"lètmein",

0 commit comments

Comments
 (0)