Fix a bug in the accept invitation that was throwing a 500.

- If the token for invitation was expired, the method would throw a 500 while creating the erorr message.
- Added unit tests.
This commit is contained in:
Rebecca Law
2016-09-12 16:16:02 +01:00
parent af70d6d15c
commit bab9360519
3 changed files with 60 additions and 2 deletions

View File

@@ -33,8 +33,7 @@ def get_invited_user_by_token(token):
current_app.config['DANGEROUS_SALT'],
max_age_seconds)
except SignatureExpired:
message = 'Invitation with id {} expired'.format(invited_user_id)
errors = {'invitation': [message]}
errors = {'invitation': ['Invitation has expired']}
raise InvalidRequest(errors, status_code=400)
invited_user = get_invited_user_by_id(invited_user_id)