mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
Create unit tests that test the forms.
This commit is contained in:
@@ -62,7 +62,6 @@ class VerifyForm(Form):
|
||||
Regexp(regex=verify_code, message='Code must be 5 digits')])
|
||||
|
||||
def validate_email_code(self, a):
|
||||
print('validating the email_code')
|
||||
code = verify_codes_dao.get_code(session['user_id'], 'email')
|
||||
validate_code(self.email_code, code)
|
||||
|
||||
@@ -72,7 +71,7 @@ class VerifyForm(Form):
|
||||
|
||||
|
||||
def validate_code(field, code):
|
||||
if code.expiry_datetime < datetime.now():
|
||||
if code.expiry_datetime > datetime.now():
|
||||
field.errors.append('Code has expired')
|
||||
return False
|
||||
if field.data is not None:
|
||||
|
||||
@@ -20,5 +20,4 @@ def process_verify():
|
||||
login_user(user)
|
||||
return redirect('/add-service')
|
||||
else:
|
||||
print(form.errors)
|
||||
return jsonify(form.errors), 400
|
||||
|
||||
Reference in New Issue
Block a user