tests: adapt to change in password field
This commit is contained in:
parent
1e4aa8a1e9
commit
c60cf90548
|
@ -132,52 +132,52 @@ def test_passwordentry_widget_success():
|
|||
req.form = {}
|
||||
assert widget.parse() is None
|
||||
|
||||
widget = PasswordEntryWidget('test', value={'plain': 'foo'}, formats=['plain'])
|
||||
widget = PasswordEntryWidget('test', value={'cleartext': 'foo'}, formats=['cleartext'])
|
||||
req.form = {}
|
||||
assert widget.parse() == {'plain': 'foo'}
|
||||
assert widget.parse() == {'cleartext': 'foo'}
|
||||
|
||||
widget = PasswordEntryWidget('test', formats=['plain'])
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'])
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': ''})
|
||||
assert widget.parse() is None
|
||||
|
||||
widget = PasswordEntryWidget('test', formats=['plain'])
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'])
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': 'foo', 'test$pwd2': 'foo'})
|
||||
assert widget.parse() == {'plain': 'foo'}
|
||||
assert widget.parse() == {'cleartext': 'foo'}
|
||||
|
||||
|
||||
def test_passwordentry_widget_errors():
|
||||
# mismatch
|
||||
widget = PasswordEntryWidget('test', formats=['plain'])
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'])
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': 'foo', 'test$pwd2': 'bar'})
|
||||
assert widget.parse() is None
|
||||
assert widget.has_error() is True
|
||||
|
||||
# too short
|
||||
widget = PasswordEntryWidget('test', formats=['plain'], min_length=4)
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'], min_length=4)
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': 'foo', 'test$pwd2': 'foo'})
|
||||
assert widget.parse() is None
|
||||
assert widget.has_error() is True
|
||||
|
||||
# uppercases
|
||||
widget = PasswordEntryWidget('test', formats=['plain'], count_uppercase=1)
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'], count_uppercase=1)
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': 'foo', 'test$pwd2': 'foo'})
|
||||
assert widget.parse() is None
|
||||
assert widget.has_error() is True
|
||||
|
||||
# digits
|
||||
widget = PasswordEntryWidget('test', formats=['plain'], count_digit=1)
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'], count_digit=1)
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': 'foo', 'test$pwd2': 'foo'})
|
||||
assert widget.parse() is None
|
||||
assert widget.has_error() is True
|
||||
|
||||
# specials
|
||||
widget = PasswordEntryWidget('test', formats=['plain'], count_special=1)
|
||||
widget = PasswordEntryWidget('test', formats=['cleartext'], count_special=1)
|
||||
req.form = {}
|
||||
mock_form_submission(req, widget, {'test$pwd1': 'foo', 'test$pwd2': 'foo'})
|
||||
assert widget.parse() is None
|
||||
|
|
Loading…
Reference in New Issue