def test_passwords_must_be_of_sufficient_length():
password = "tooShort"
form = Bag(username=user_name, password=password, passcheck=password,
email='foo', emailcheck='foo',
day='12', month='12', year=arrow.now().year - 19)
# Insecure length
with pytest.raises(WeasylError) as err:
login.create(form)
assert 'passwordInsecure' == err.value.value
# Secure length
password = "thisIsAcceptable"
form.passcheck = form.password = password
# emailInvalid is the next failure state after passwordInsecure, so it is a 'success' for this testcase
with pytest.raises(WeasylError) as err:
login.create(form)
assert 'emailInvalid' == err.value.value
评论列表
文章目录