misc: check SIREN code for ASCII digits (#42808)
This commit is contained in:
parent
4c097aa37b
commit
3690d3c987
|
@ -737,6 +737,11 @@ def test_wcsextrastringwidget_siren_validation():
|
|||
mock_form_submission(req, widget, {'test': 'XXX170130'})
|
||||
assert widget.has_error()
|
||||
|
||||
widget = WcsExtraStringWidget('test', value='foo', required=False)
|
||||
widget.field = fakefield
|
||||
mock_form_submission(req, widget, {'test': '443170¹39'})
|
||||
assert widget.has_error()
|
||||
|
||||
|
||||
def test_wcsextrastringwidget_siret_validation():
|
||||
class FakeField: pass
|
||||
|
|
|
@ -685,7 +685,7 @@ def validate_luhn(string_value, length=None):
|
|||
return False
|
||||
if length is not None and len(string_value) != length:
|
||||
return False
|
||||
if not string_value.isdigit():
|
||||
if not is_ascii_digit(string_value):
|
||||
return False
|
||||
|
||||
# take all digits counting from the right, double value for digits pair
|
||||
|
|
Loading…
Reference in New Issue