Skip to content

Commit 610644e

Browse files
committed
Fix the validator
1 parent 5c2527c commit 610644e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pwned/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PwnedValidator:
1212
code = 'invalid'
1313
client = PwnedClient
1414

15-
def __call__(self, password):
15+
def validate(self, password, user=None):
1616
pwned_client = self.client()
1717
count = pwned_client.count_occurrences(password)
1818
if count >= app_settings.PWNED['OCCURRENCE_THRESHOLD']:

tests/test_validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
def test_validator_found():
1010
validator = PwnedValidator()
1111
with pytest.raises(ValidationError):
12-
validator('password')
12+
validator.validate('password')
1313

1414

1515
@pytest.mark.vcr
1616
def test_validator_not_found():
1717
validator = PwnedValidator()
18-
validator('8CEF1E00B20F463C1E48B589B03660D4E3B9EF7A')
18+
validator.validate('8CEF1E00B20F463C1E48B589B03660D4E3B9EF7A')

0 commit comments

Comments
 (0)